<!DOCTYPE html><html lang="en"><head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
  <meta content="CR" name="w3c-status">
  <title>HTML 5.1: 5. User interaction</title>
  <link href="styles/styles-html.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href=styles.default.css>
  <meta content="Bikeshed 1.0.0" name="generator">

  <link href="styles/W3C-CR" rel="stylesheet" type="text/css">
 </head>
 <body class="h-entry">
  <div class="head">
   <header>
    <p data-fill-with="logo"><a href="http://www.w3.org/"><img alt="W3C" height="48" src="styles/logos/W3C" width="72"></a></p>
    <h1 class="p-name no-ref allcaps" id="title">HTML 5.1</h1>
    <h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">W3C Candidate Recommendation, <time class="dt-updated" datetime="2016-06-21">21 June 2016</time></span></h2>
   </header>
   
   
   
   
  </div>
  
  
  
  
  
  <nav data-fill-with="table-of-contents" id="toc"><p class="prev_next">← <a href="matching-html-elements-using-selectors.html#matching-html-elements-using-selectors"><span class="secno">4.15</span> <span class="content">Matching HTML elements using selectors</span></a> — <a href="index.html#contents">Table of contents</a> — <a href="browsers.html#browsers"><span class="secno">6</span> <span class="content">Loading Web pages</span></a> →</p>
   <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
   <ol class="toc" role="directory"><li>
     <a href="editing.html#editing"><span class="secno">5</span> <span class="content">User interaction</span></a>
     <ol class="toc">
      <li><a href="editing.html#the-hidden-attribute"><span class="secno">5.1</span> <span class="content">The <span><code>hidden</code></span> attribute</span></a>
      </li><li><a href="editing.html#inert-subtrees"><span class="secno">5.2</span> <span class="content">Inert subtrees</span></a>
      </li><li><a href="editing.html#activation"><span class="secno">5.3</span> <span class="content">Activation</span></a>
      </li><li>
       <a href="editing.html#focus"><span class="secno">5.4</span> <span class="content">Focus</span></a>
       <ol class="toc">
        <li><a href="editing.html#focus-introduction"><span class="secno">5.4.1</span> <span class="content">Introduction</span></a>
        </li><li><a href="editing.html#data-model"><span class="secno">5.4.2</span> <span class="content">Data model</span></a>
        </li><li><a href="editing.html#the-tabindex-attribute"><span class="secno">5.4.3</span> <span class="content">The <code>tabindex</code> attribute</span></a>
        </li><li><a href="editing.html#focus-processing-model"><span class="secno">5.4.4</span> <span class="content">Processing model</span></a>
        </li><li><a href="editing.html#sec-sequential-focus-navigation"><span class="secno">5.4.5</span> <span class="content">Sequential focus navigation</span></a>
        </li><li><a href="editing.html#focus-management-apis"><span class="secno">5.4.6</span> <span class="content">Focus management APIs</span></a>
       </li></ol>
      </li><li>
       <a href="editing.html#assigning-keyboard-shortcuts"><span class="secno">5.5</span> <span class="content">Assigning keyboard shortcuts</span></a>
       <ol class="toc">
        <li><a href="editing.html#assigning-keyboard-shortcuts-introduction"><span class="secno">5.5.1</span> <span class="content">Introduction</span></a>
        </li><li><a href="editing.html#the-accesskey-attribute"><span class="secno">5.5.2</span> <span class="content">The <code>accesskey</code> attribute</span></a>
        </li><li><a href="editing.html#assigning-keyboard-shortcuts-processing-model"><span class="secno">5.5.3</span> <span class="content">Processing model</span></a>
       </li></ol>
      </li><li>
       <a href="editing.html#user-interaction-editing"><span class="secno">5.6</span> <span class="content">Editing</span></a>
       <ol class="toc">
        <li><a href="editing.html#making-document-regions-editable-the-contenteditable-content-attribute"><span class="secno">5.6.1</span> <span class="content">Making document regions editable: The <code>contenteditable</code> content attribute</span></a>
        </li><li><a href="editing.html#making-entire-documents-editable-the-designmode-idl-attribute"><span class="secno">5.6.2</span> <span class="content">Making entire documents editable: The <code>designMode</code> IDL attribute</span></a>
        </li><li><a href="editing.html#best-practices-for-in-page-editors"><span class="secno">5.6.3</span> <span class="content">Best practices for in-page editors</span></a>
        </li><li><a href="editing.html#editing-apis"><span class="secno">5.6.4</span> <span class="content">Editing APIs</span></a>
        </li><li><a href="editing.html#spelling-and-grammar-checking"><span class="secno">5.6.5</span> <span class="content">Spelling and grammar checking</span></a>
       </li></ol>
      </li><li>
       <a href="editing.html#drag-and-drop"><span class="secno">5.7</span> <span class="content">Drag and drop</span></a>
       <ol class="toc">
        <li><a href="editing.html#drag-and-drop-introduction"><span class="secno">5.7.1</span> <span class="content">Introduction</span></a>
        </li><li><a href="editing.html#the-drag-data-store"><span class="secno">5.7.2</span> <span class="content">The drag data store</span></a>
        </li><li>
         <a href="editing.html#the-datatransfer-interface"><span class="secno">5.7.3</span> <span class="content">The <code>DataTransfer</code> interface</span></a>
         <ol class="toc">
          <li><a href="editing.html#the-datatransferitemlist-interface"><span class="secno">5.7.3.1</span> <span class="content">The <code>DataTransferItemList</code> interface</span></a>
          </li><li><a href="editing.html#the-datatransferitem-interface"><span class="secno">5.7.3.2</span> <span class="content">The <code>DataTransferItem</code> interface</span></a>
         </li></ol>
        </li><li><a href="editing.html#the-dragevent-interface"><span class="secno">5.7.4</span> <span class="content">The <code>DragEvent</code> interface</span></a>
        </li><li><a href="editing.html#drag-and-drop-processing-model"><span class="secno">5.7.5</span> <span class="content">Drag-and-drop processing model</span></a>
        </li><li><a href="editing.html#events-summary"><span class="secno">5.7.6</span> <span class="content"><span>Events summary</span></span></a>
        </li><li><a href="editing.html#the-draggable-attribute"><span class="secno">5.7.7</span> <span class="content">The <code>draggable</code> attribute</span></a>
        </li><li><a href="editing.html#the-dropzone-attribute"><span class="secno">5.7.8</span> <span class="content">The <code>dropzone</code> attribute</span></a>
        </li><li><a href="editing.html#security-risks-in-the-drag-and-drop-model"><span class="secno">5.7.9</span> <span class="content">Security risks in the drag-and-drop model</span></a>
       </li></ol>
     </li></ol>
    </li></ol>
  </nav><main><section>
    <h2 class="heading settled" data-level="5" id="editing"><span class="secno">5. </span><span class="content">User interaction</span><a class="self-link" href="editing.html#editing"></a></h2>
    <h3 class="heading settled" data-level="5.1" id="the-hidden-attribute"><span class="secno">5.1. </span><span class="content">The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="hidden"><code>hidden</code></dfn> attribute</span><a class="self-link" href="editing.html#the-hidden-attribute"></a></h3>
    <p>All <a data-link-type="dfn" href="infrastructure.html#html-element" id="ref-for-html-element-55">html elements</a> may have the <code>hidden</code> content attribute set. The <code>hidden</code> attribute is a <a data-link-type="dfn" href="infrastructure.html#boolean-attribute" id="ref-for-boolean-attribute-33">boolean attribute</a>. When specified on an element, it
  indicates that the element is not yet, or is no longer, directly relevant to the page’s current
  state, or that it is being used to declare content to be reused by other parts of the page as
  opposed to being directly accessed by the user. <span class="impl">User agents should not render
  elements that have the <code>hidden</code> attribute specified. This requirement may be
  implemented indirectly through the style layer. For example, an HTML+CSS user agent could
  implement these requirements using the rules suggested in <a href="rendering.html#rendering">§10 Rendering</a>.</span></p>
    <p class="note" role="note"> Because this attribute is typically implemented using CSS, it’s also possible to override it
    using CSS. For instance, a rule that applies 'display: block' to all elements will cancel the
    effects of the <code>hidden</code> attribute. Authors therefore have to take care when writing
    their style sheets to make sure that the attribute is still styled as expected. </p>
    <div class="example" id="example-0f32ae7c">
     <a class="self-link" href="editing.html#example-0f32ae7c"></a> In the following skeletal example, the attribute is used to hide the Web game’s main screen
    until the user logs in: 
<pre class="highlight"><span class="nt">&lt;h1&gt;</span>The Example Game<span class="nt">&lt;/h1&gt;</span>
<span class="nt">&lt;section&gt;</span>
  <span class="nt">&lt;h2&gt;</span>Login<span class="nt">&lt;/h2&gt;</span>
  <span class="nt">&lt;form&gt;</span>
  ...
  <span class="c">&lt;!-- calls login() once the user’s credentials have been checked --&gt;</span>
  <span class="nt">&lt;/form&gt;</span>
  <span class="nt">&lt;script&gt;</span>
  <span class="kd">function</span> <span class="nx">login</span><span class="p">()</span> <span class="p">{</span>
    <span class="c1">// switch screens</span>
    <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">'login'</span><span class="p">).</span><span class="nx">hidden</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
    <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">'game'</span><span class="p">).</span><span class="nx">hidden</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
  <span class="p">}</span>
  <span class="nt">&lt;/script&gt;</span>
<span class="nt">&lt;/section&gt;</span>
<span class="nt">&lt;section</span> <span class="na">hidden</span><span class="nt">&gt;</span>
  ...
<span class="nt">&lt;/section&gt;</span>
</pre>
    </div>
    <p>The <code>hidden</code> attribute must not be used to hide content just from one presentation —
  if something is marked <code>hidden</code>, it is hidden from all presentations, including, for instance, screen readers.</p>
    <p>Elements that are not themselves <code>hidden</code> must not <a data-link-type="dfn" href="links.html#hyperlink" id="ref-for-hyperlink-61">hyperlink</a> to elements that are <code>hidden</code>. The <code>for</code> attributes of <code>label</code> and <code><a data-link-type="element" href="sec-forms.html#elementdef-output" id="ref-for-elementdef-output-18">output</a></code> elements that are not
  themselves <code>hidden</code> must similarly not refer to elements that are <code>hidden</code>. In both cases, such references would cause user confusion.</p>
    <p>Elements and scripts may, however, refer to elements that are <code>hidden</code> in other contexts.</p>
    <div class="example" id="example-7208126f">
     <a class="self-link" href="editing.html#example-7208126f"></a> For example, it would be incorrect to use the <code><a data-link-type="element-sub" href="links.html#element-attrdef-a-href" id="ref-for-element-attrdef-a-href-29">href</a></code> attribute to link to a
    section marked with the <code>hidden</code> attribute. If the content is not applicable or relevant, then there
    is no reason to link to it. 
     <p>It would be fine, however, to use the ARIA <code>aria-describedby</code> attribute to
    refer to descriptions that are themselves <code>hidden</code>. While hiding the descriptions
    implies that they are not useful alone, they could be written in
    such a way that they are useful in the specific context of being
    referenced from the images that they describe.</p>
     <p>Similarly, a <code><a data-link-type="element" href="semantics-scripting.html#elementdef-canvas" id="ref-for-elementdef-canvas-51">canvas</a></code> element with the <code>hidden</code> attribute could be used by a
    scripted graphics engine as an off-screen buffer, and a form
    control could refer to a hidden <code><a data-link-type="element" href="sec-forms.html#elementdef-form" id="ref-for-elementdef-form-92">form</a></code> element using its <code>form</code> attribute.</p>
    </div>
    <p>Accessibility APIs are encouraged to provide a way to expose
  structured content while marking it as hidden in the default view.
  Such content should not be perceivable to users in the normal document
  flow in any modality, whether using Assistive Technology (AT) or
  mainstream User Agents.</p>
    <p>When such features are available, User Agents may use them to
  expose the full semantics of <code>hidden</code> elements to AT when appropriate, if such content is referenced
  indirectly by an <a data-link-type="dfn" href="https://www.w3.org/TR/dom/#concept-id">ID reference</a> or <a data-link-type="dfn" href="infrastructure.html#valid-hash-name-reference" id="ref-for-valid-hash-name-reference-2">valid hash-name reference</a>. This allows ATs to access the
  structure of these <code>hidden</code> elements
  upon user request, while keeping the content hidden in all
  presentations of the normal document flow. Authors who wish to prevent
  user-initiated viewing of a <code>hidden</code> element should not reference the element with such a mechanism.</p>
    <p>Because some User Agents have flattened hidden content when
  exposing such content to AT, authors should not reference <code>hidden</code> content which would lose essential
  meaning when flattened.</p>
    <div class="example" id="example-e9e38828">
     <a class="self-link" href="editing.html#example-e9e38828"></a> For example, it would be incorrect to use the <code><a data-link-type="element-sub" href="links.html#element-attrdef-a-href" id="ref-for-element-attrdef-a-href-30">href</a></code> attribute to link to a section marked with the <code>hidden</code> attribute.
    If the content is not applicable or relevant, then there is no reason to link to it. 
     <p>It would be fine, however, to use the ARIA <code>aria-describedby</code> attribute to refer to descriptions that are
    themselves <code>hidden</code>. While hiding the descriptions implies that
    they are not useful alone, they could be written in such a way that they are useful in the
    specific context of being referenced from the images that they describe.</p>
     <p>Similarly, a <code><a data-link-type="element" href="semantics-scripting.html#elementdef-canvas" id="ref-for-elementdef-canvas-52">canvas</a></code> element with the <code>hidden</code> attribute could be used by a scripted graphics engine as an off-screen buffer, and a form control
    could refer to a hidden <code><a data-link-type="element" href="sec-forms.html#elementdef-form" id="ref-for-elementdef-form-93">form</a></code> element using its <code>form</code> attribute.</p>
    </div>
    <p>Elements in a section hidden by the <code>hidden</code> attribute are still
  active, e.g., scripts and form controls in such sections still execute and submit respectively.
  Only their presentation to the user changes.</p>
    <div class="impl"> The <dfn class="idl-code" data-dfn-for="common" data-dfn-type="attribute" data-export="" id="dom-common-hidden"><code>hidden</code><a class="self-link" href="editing.html#dom-common-hidden"></a></dfn> IDL attribute must <a data-link-type="dfn" href="infrastructure.html#reflection" id="ref-for-reflection-116">reflect</a> the
    content attribute of the same name. </div>
    <h3 class="heading settled" data-level="5.2" id="inert-subtrees"><span class="secno">5.2. </span><span class="content">Inert subtrees</span><a class="self-link" href="editing.html#inert-subtrees"></a></h3>
    <p class="note" role="note"> This section <strong>does not</strong> define or create any content attribute
  named "inert". This section merely defines an abstract <em>concept</em> of <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-11">inertness</a>. </p>
    <p>A node (in particular elements and text nodes) can be marked as <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="inertness|inert" data-noexport="" id="inertness">inert</dfn>. When a node
  is <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-12">inert</a>, then the user agent must act as if the node was absent for the purposes of
  targeting user interaction events, may ignore the node for the purposes of text search user
  interfaces (commonly known as "find in page"), and may prevent the user from selecting text in
  that node. User agents should allow the user to override the restrictions on search and text
  selection, however.</p>
    <p class="example" id="example-181959b1"><a class="self-link" href="editing.html#example-181959b1"></a> For example, consider a page that consists of just a single <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-13">inert</a> paragraph positioned in the middle of a <code><a data-link-type="element" href="sections.html#elementdef-body" id="ref-for-elementdef-body-53">body</a></code>. If a user moves their pointing device
  from the <code>body</code> over to the <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-14">inert</a> paragraph and clicks on the paragraph,
  no <code>mouseover</code> event would be fired, and the <code>mousemove</code> and <code>click</code> events would
  be fired on the <code><a data-link-type="element" href="sections.html#elementdef-body" id="ref-for-elementdef-body-54">body</a></code> element rather than the paragraph. </p>
    <p class="note" role="note"> When a node is inert, it generally cannot be focused. Inert nodes that are <a data-link-type="dfn" href="interactive-elements.html#menuitem-defines-a-command" id="ref-for-menuitem-defines-a-command-14">commands</a> will also get disabled. </p>
    <p>While a <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-4">browsing context container</a> is marked as <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-15">inert</a>, its <a data-link-type="dfn" href="browsers.html#nested-browsing-contexts" id="ref-for-nested-browsing-contexts-41">nested browsing context</a>’s <a data-link-type="dfn" href="browsers.html#active-document" id="ref-for-active-document-27">active document</a>, and all nodes in that <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>, must be marked as <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-16">inert</a>.</p>
    <p>An entire <code>Document</code> can be marked as <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="blocked by the modal dialog|blocked by a modal dialog" data-noexport="" id="blocked-by-the-modal-dialog">blocked by a modal dialog</dfn> <var>subject</var>. While a <code>Document</code> is so marked, every node that is <a data-link-type="dfn" href="infrastructure.html#in-the-document" id="ref-for-in-the-document-22">in the <code>Document</code></a>, with the exception of the <var>subject</var> element and its
  descendants, must be marked <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-17">inert</a>. (The elements excepted by this paragraph can
  additionally be marked <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-18">inert</a> through other means; being part of a modal dialog does not
  "protect" a node from being marked <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-19">inert</a>.)</p>
    <p>Only one element at a time can mark a <code>Document</code> as being <a data-link-type="dfn" href="editing.html#blocked-by-the-modal-dialog" id="ref-for-blocked-by-the-modal-dialog-6">blocked by a modal
  dialog</a>. When a new <code><a data-link-type="element" href="interactive-elements.html#elementdef-dialog" id="ref-for-elementdef-dialog-35">dialog</a></code> is made to block a <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>, the previous element, if any, stops blocking the <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>.</p>
    <p class="note" role="note"> The <code><a data-link-type="element" href="interactive-elements.html#elementdef-dialog" id="ref-for-elementdef-dialog-36">dialog</a></code> element’s <code>showModal()</code> method makes use of this mechanism. </p>
    <h3 class="heading settled" data-level="5.3" id="activation"><span class="secno">5.3. </span><span class="content">Activation</span><a class="self-link" href="editing.html#activation"></a></h3>
    <p>Certain elements in HTML have an <a data-link-type="dfn" href="editing.html#activation-behavior" id="ref-for-activation-behavior-42">activation behavior</a>, which means that the user
  can activate them. This triggers a sequence of events dependent on the activation mechanism, and
  normally culminating in a <code>click</code> event<span class="impl">, as described below</span>.</p>
    <div class="impl">
     <p>The user agent should allow the user to manually trigger elements that have an <a data-link-type="dfn" href="editing.html#activation-behavior" id="ref-for-activation-behavior-43">activation
  behavior</a>, for instance using keyboard or voice input, or through mouse clicks. When the
  user triggers an element with a defined <a data-link-type="dfn" href="editing.html#activation-behavior" id="ref-for-activation-behavior-44">activation behavior</a> in a manner other than
  clicking it, the default action of the interaction event must be to <a data-link-type="dfn" href="editing.html#running-synthetic-click-activation-steps" id="ref-for-running-synthetic-click-activation-steps-8">run synthetic click
  activation steps</a> on the element.</p>
     <p>Each element has a <var>click in progress</var> flag, initially set to false.</p>
     <p>When a user agent is to <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="running synthetic click activation steps|run synthetic click activation steps" data-noexport="" id="running-synthetic-click-activation-steps">run synthetic click activation steps</dfn> on an element, the user
  agent must run the following steps:</p>
     <ol>
      <li>If the element’s <var>click in progress</var> flag is set to true, then abort
    these steps.
      </li><li>Set the <var>click in progress</var> flag on the element to true.
      </li><li><a data-link-type="dfn" href="editing.html#run-pre-click-activation-steps" id="ref-for-run-pre-click-activation-steps-1">Run pre-click activation steps</a> on the element.
      </li><li><a data-link-type="dfn" href="webappapis.html#fire-a-click-event" id="ref-for-fire-a-click-event-6">Fire a <code>click</code> event</a> at the element. If the <a data-link-type="dfn" href="editing.html#running-synthetic-click-activation-steps" id="ref-for-running-synthetic-click-activation-steps-9">run synthetic click activation steps</a> algorithm was invoked because the <code>click()</code> method was invoked, then the <code>isTrusted</code> attribute must be initialized to false.
      </li><li>
       <p>If this <code>click</code> event is not canceled, <a data-link-type="dfn" href="editing.html#run-post-click-activation-steps" id="ref-for-run-post-click-activation-steps-1">run post-click
    activation steps</a> on the element.</p>
       <p>If the event <em>is</em> canceled, the user agent must <a data-link-type="dfn" href="editing.html#run-canceled-activation-steps" id="ref-for-run-canceled-activation-steps-1">run canceled activation
    steps</a> on the element instead.</p>
      </li><li>Set the <var>click in progress</var> flag on the element to false.
     </li></ol>
     <p>When a pointing device is clicked, the user agent must <a data-link-type="dfn" href="editing.html#run-authentic-click-activation-steps" id="ref-for-run-authentic-click-activation-steps-1">run authentic click activation
  steps</a> instead of firing the <code>click</code> event. When a user agent is to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="run-authentic-click-activation-steps">run authentic click activation steps</dfn> for a given event <var>event</var>, it must
  follow these steps:</p>
     <ol>
      <li>Let <var>target</var> be the element designated by the user (the target of <var>event</var>).
      </li><li>If <var>target</var> is a <code><a data-link-type="element" href="semantics-scripting.html#elementdef-canvas" id="ref-for-elementdef-canvas-53">canvas</a></code> element, run the canvas <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/uievents/#interface-MouseEvent">MouseEvent</a></code> rerouting steps. If this changes <var>event</var>’s
    target, then let <var>target</var> be the new target.
      </li><li>Set the <var>click in progress</var> flag on <var>target</var> to
    true.
      </li><li>Let <var>e</var> be the <a data-link-type="dfn" href="editing.html#nearest-activatable-element" id="ref-for-nearest-activatable-element-1">nearest activatable element</a> of <var>target</var> (defined below), if any.
      </li><li>If there is an element <var>e</var>, <a data-link-type="dfn" href="editing.html#run-pre-click-activation-steps" id="ref-for-run-pre-click-activation-steps-2">run pre-click activation steps</a> on it.
      </li><li>
       <p><a data-link-type="dfn" href="infrastructure.html#dispatch" id="ref-for-dispatch-2">Dispatch</a> <var>event</var> (the
    required <code>click</code> event) at <var>target</var>.</p>
       <p>If there is an element <var>e</var> and the <code>click</code> event is not canceled, <a data-link-type="dfn" href="editing.html#run-post-click-activation-steps" id="ref-for-run-post-click-activation-steps-2">run post-click activation steps</a> on element <var>e</var>.</p>
       <p>If there is an element <var>e</var> and the event <em>is</em> canceled, <a data-link-type="dfn" href="editing.html#run-canceled-activation-steps" id="ref-for-run-canceled-activation-steps-2">run
    canceled activation steps</a> on element <var>e</var>.</p>
      </li><li>Set the <var>click in progress</var> flag on <var>target</var> to
    false.
     </li></ol>
     <p class="note" role="note"> The algorithms above don’t run for arbitrary synthetic events dispatched by author script. The <code>click()</code> method can be used to make the <a data-link-type="dfn" href="editing.html#running-synthetic-click-activation-steps" id="ref-for-running-synthetic-click-activation-steps-10">run synthetic click activation steps</a> algorithm happen programmatically. </p>
     <p class="note" role="note"> Click-focusing behavior (e.g., the focusing of a text field when user clicks in one) typically
    happens before the click, when the mouse button is first depressed, and is therefore not
    discussed here. </p>
     <p>Given an element <var>target</var>, the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="nearest-activatable-element">nearest activatable element</dfn> is the element
  returned by the following algorithm:</p>
     <ol>
      <li>If <var>target</var> has a defined <a data-link-type="dfn" href="editing.html#activation-behavior" id="ref-for-activation-behavior-45">activation behavior</a>, then return <var>target</var> and abort these steps.
      </li><li>If <var>target</var> has a parent element, then set <var>target</var> to
    that parent element and return to the first step.
      </li><li>Otherwise, there is no <a data-link-type="dfn" href="editing.html#nearest-activatable-element" id="ref-for-nearest-activatable-element-2">nearest activatable element</a>.
     </li></ol>
     <p>When a user agent is to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="run-pre-click-activation-steps">run pre-click activation steps</dfn> on an element, it must run
  the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="pre-click-activation-steps">pre-click activation steps</dfn> defined for that element, if any.</p>
     <p>When a user agent is to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="run-canceled-activation-steps">run canceled activation steps</dfn> on an element, it must run the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="canceled-activation-steps">canceled activation steps</dfn> defined for that element, if any.</p>
     <p>When a user agent is to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="run-post-click-activation-steps">run post-click activation steps</dfn> on an element, it must run
  the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="activation-behavior">activation behavior</dfn> defined for that element, if any. Activation behaviors can
  refer to the <code>click</code> event that was fired by the steps above
  leading up to this point.</p>
    </div>
    <dl class="domintro">
     <dt><var>element</var> . <code>click</code>()
     </dt><dd>Acts as if the element was clicked.
    </dd></dl>
    <div class="impl">
      The <dfn class="idl-code" data-dfn-for="common" data-dfn-type="method" data-export="" id="dom-common-click"><code>click()</code><a class="self-link" href="editing.html#dom-common-click"></a></dfn> method must run the following steps: 
     <ol>
      <li data-md="">
       <p>If the element is a form control that is disabled, abort these steps.</p>
      </li><li data-md="">
       <p><a data-link-type="dfn" href="editing.html#running-synthetic-click-activation-steps" id="ref-for-running-synthetic-click-activation-steps-11">Run synthetic click activation steps</a> on the element.</p>
     </li></ol>
    </div>
    <h3 class="heading settled" data-level="5.4" id="focus"><span class="secno">5.4. </span><span class="content">Focus</span><a class="self-link" href="editing.html#focus"></a></h3>
    <h4 class="heading settled" data-level="5.4.1" id="focus-introduction"><span class="secno">5.4.1. </span><span class="content">Introduction</span><a class="self-link" href="editing.html#focus-introduction"></a></h4>
    <p><em>This section is non-normative.</em></p>
    <p>An HTML user interface typically consists of multiple interactive widgets, such as form
  controls, scrollable regions, links, dialog boxes, browser tabs, and so forth. These widgets form
  a hierarchy, with some (e.g., browser tabs, dialog boxes) containing others (e.g., links, form
  controls).</p>
    <p>When interacting with an interface using a keyboard, key input is channeled from the system,
  through the hierarchy of interactive widgets, to an active widget, which is said to be <a data-link-type="dfn" href="editing.html#focused" id="ref-for-focused-7">focused</a>.</p>
    <div class="example" id="example-592aaa68">
     <a class="self-link" href="editing.html#example-592aaa68"></a> Consider an HTML application running in a browser tab running in a graphical environment.
    Suppose this application had a page with some text fields and links, and was currently showing a
    modal dialog, which itself had a text field and a button. 
     <p>The hierarchy of focusable widgets, in this scenario, would include the browser window, which
    would have, amongst its children, the browser tab containing the HTML application. The tab itself
    would have as its children the various links and text fields, as well as the dialog. The dialog
    itself would have as its children the text field and the button.</p>
     <p><img alt="" height="450" src="images/focus-tree.png" width="800"></p>
     <p>If the widget with <a data-link-type="dfn" href="editing.html#focused" id="ref-for-focused-8">focus</a> in this example was the text field in the dialog box, then key
    input would be channeled from the graphical system to ① the Web browser, then to ②
    the tab, then to ③ the dialog, and finally to ④ the text field.</p>
    </div>
    <p>Keyboard <em>events</em> are always targeted at this <a data-link-type="dfn" href="editing.html#focused" id="ref-for-focused-9">focused</a> element.</p>
    <h4 class="heading settled" data-level="5.4.2" id="data-model"><span class="secno">5.4.2. </span><span class="content">Data model</span><a class="self-link" href="editing.html#data-model"></a></h4>
    <p>The term <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="focusable|focusable area" data-noexport="" id="focusable">focusable area</dfn> is used to refer to regions of the interface that can become
  the target of keyboard input. Focusable areas can be elements, parts of elements, or other regions
  managed by the user agent.</p>
    <p>Each <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-3">focusable area</a> has a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="dom-anchor">DOM anchor</dfn>, which is a <code>Node</code> object
  that represents the position of the <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-4">focusable area</a> in the DOM. (When the <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-5">focusable
  area</a> is itself a <code>Node</code>, it is its own <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-2">DOM anchor</a>.) The <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-3">DOM anchor</a> is
  used in some APIs as a substitute for the <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-6">focusable area</a> when there is no other DOM object
  to represent the <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-7">focusable area</a>.</p>
    <p>The following table describes what objects can be <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-8">focusable
  areas</a>. The cells in the left column describe objects that can be <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-9">focusable areas</a>; the cells in the right column describe the <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-4">DOM
  anchors</a> for those elements. (The cells that span both columns are non-normative examples.)</p>
    <table>
     <thead>
      <tr>
       <th id="th-fa-area"><a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-10">Focusable area</a> 
       </th><th id="th-fa-dom-rep"><a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-5">DOM anchor</a> 
      </th></tr><tr>
       <th colspan="2" id="th-fa-examples">Examples 
     </th></tr></thead><tbody>
      <tr>
       <th class="data-header" headers="th-fa-area" id="td-fa-1"> Elements that have their <a data-link-type="dfn" href="editing.html#can-be-focused" id="ref-for-can-be-focused-3">tabindex focus flag</a> set, that are not <a data-link-type="dfn" href="disabled-elements.html#disabling" id="ref-for-disabling-3">actually disabled</a>, that are not <a data-link-type="dfn" href="editing.html#expressly-inert" id="ref-for-expressly-inert-1">expressly inert</a>, and that are either <a data-link-type="dfn" href="rendering.html#being-rendered" id="ref-for-being-rendered-13">being
      rendered</a> or <a data-link-type="dfn" href="semantics-scripting.html#being-used-as-relevant-canvas-fallback-content" id="ref-for-being-used-as-relevant-canvas-fallback-content-1">being used as relevant canvas fallback content</a>. 
       </th><td headers="td-fa-1 th-fa-dom-rep"> The element itself. 
      </td></tr><tr>
       <td colspan="2" headers="td-fa-1 th-fa-examples">
        <p class="example" id="example-d41d8cd9"><a class="self-link" href="editing.html#example-d41d8cd9"></a> </p>
        <p><code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-iframe" id="ref-for-elementdef-iframe-51">iframe</a></code>, <code>&lt;input
      type=text&gt;</code>, sometimes <code>&lt;a href=""&gt;</code> (depending on platform
      conventions).</p>
        <p></p>
     </td></tr></tbody><tbody>
      <tr>
       <th class="data-header" headers="th-fa-area" id="td-fa-2"> The shapes of <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-area" id="ref-for-elementdef-area-81">area</a></code> elements in an <a data-link-type="dfn" href="semantics-embedded-content.html#image-map" id="ref-for-image-map-10">image map</a> associated with an <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-img" id="ref-for-elementdef-img-141">img</a></code> element that is <a data-link-type="dfn" href="rendering.html#being-rendered" id="ref-for-being-rendered-14">being rendered</a> and is not <a data-link-type="dfn" href="editing.html#expressly-inert" id="ref-for-expressly-inert-2">expressly inert</a>. 
       </th><td headers="td-fa-2 th-fa-dom-rep"> The <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-img" id="ref-for-elementdef-img-142">img</a></code> element. 
      </td></tr><tr>
       <td colspan="2" headers="td-fa-2 th-fa-examples">
        <div class="example" id="example-78107be7">
         <a class="self-link" href="editing.html#example-78107be7"></a> In the following example, the <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-area" id="ref-for-elementdef-area-82">area</a></code> element creates two shapes, one on each
      image. The <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-6">DOM anchor</a> of the first shape is the first <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-img" id="ref-for-elementdef-img-143">img</a></code> element, and the <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-7">DOM anchor</a> of the second shape is the second <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-img" id="ref-for-elementdef-img-144">img</a></code> element. 
<pre class="highlight"><span class="nt">&lt;map</span> <span class="na">id=</span><span class="s">wallmap</span><span class="nt">&gt;&lt;area</span> <span class="na">alt=</span><span class="s">"Enter Door"</span> <span class="na">coords=</span><span class="s">"10,10,100,200"</span> <span class="na">href=</span><span class="s">"door.html"</span><span class="nt">&gt;&lt;/map&gt;</span>
...
<span class="nt">&lt;img</span> <span class="na">src=</span><span class="s">"images/innerwall.jpeg"</span> <span class="na">alt=</span><span class="s">"There is a white wall here, with a door."</span> <span class="na">usemap=</span><span class="s">"#wallmap"</span><span class="nt">&gt;</span>
...
<span class="nt">&lt;img</span> <span class="na">src=</span><span class="s">"images/outerwall.jpeg"</span> <span class="na">alt=</span><span class="s">"There is a red wall here, with a door."</span> <span class="na">usemap=</span><span class="s">"#wallmap"</span><span class="nt">&gt;</span>
</pre>
        </div>
     </td></tr></tbody><tbody>
      <tr>
       <th class="data-header" headers="th-fa-area" id="td-fa-3"> The user-agent provided subwidgets of elements that are <a data-link-type="dfn" href="rendering.html#being-rendered" id="ref-for-being-rendered-15">being rendered</a> and are not <a data-link-type="dfn" href="disabled-elements.html#disabling" id="ref-for-disabling-4">actually disabled</a> or <a data-link-type="dfn" href="editing.html#expressly-inert" id="ref-for-expressly-inert-3">expressly inert</a>. 
       </th><td headers="td-fa-3 th-fa-dom-rep"> The element for which the <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-11">focusable area</a> is a subwidget. 
      </td></tr><tr>
       <td colspan="2" headers="td-fa-3 th-fa-examples">
        <p class="example" id="example-b5349b2a"><a class="self-link" href="editing.html#example-b5349b2a"></a>The <a data-link-type="dfn" href="semantics-embedded-content.html#exposing-a-user-interface" id="ref-for-exposing-a-user-interface-5">controls in the user
      interface that is exposed to the user</a> for a <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-video" id="ref-for-elementdef-video-48">video</a></code> element, the up and down
      buttons in a spin-control version of <code>&lt;input type=number&gt;</code>, the part of a <code><a data-link-type="element" href="interactive-elements.html#elementdef-details" id="ref-for-elementdef-details-18">details</a></code> element’s rendering that enabled the element to be opened or closed using
      keyboard input. </p>
     </td></tr></tbody><tbody>
      <tr>
       <th class="data-header" headers="th-fa-area" id="td-fa-4"> The scrollable regions of elements that are <a data-link-type="dfn" href="rendering.html#being-rendered" id="ref-for-being-rendered-16">being rendered</a> and are not <a data-link-type="dfn" href="editing.html#expressly-inert" id="ref-for-expressly-inert-4">expressly inert</a>. 
       </th><td headers="td-fa-4 th-fa-dom-rep"> The element for which the box that the scrollable region scrolls was created. 
      </td></tr><tr>
       <td colspan="2" headers="td-fa-4 th-fa-examples">
        <p class="example" id="example-152c14e4"><a class="self-link" href="editing.html#example-152c14e4"></a> The CSS <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css-overflow-3/#propdef-overflow">overflow</a> property’s <span class="css">scroll</span> value typically creates a scrollable
      region. </p>
     </td></tr></tbody><tbody>
      <tr>
       <th class="data-header" headers="th-fa-area" id="td-fa-5"> The <a data-link-type="dfn" href="infrastructure.html#viewport" id="ref-for-viewport-26">viewport</a> of a <code>Document</code> that is in a <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-78">browsing context</a> and is not <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-20">inert</a>. 
       </th><td headers="td-fa-5 th-fa-dom-rep"> The <code>Document</code> for which the <a data-link-type="dfn" href="infrastructure.html#viewport" id="ref-for-viewport-27">viewport</a> was created. 
      </td></tr><tr>
       <td colspan="2" headers="td-fa-5 th-fa-examples">
        <p class="example" id="example-d2837fc5"><a class="self-link" href="editing.html#example-d2837fc5"></a> The contents of an <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-iframe" id="ref-for-elementdef-iframe-52">iframe</a></code>. </p>
     </td></tr></tbody><tbody>
      <tr>
       <th class="data-header" headers="th-fa-area" id="td-fa-6"> Any other element or part of an element, especially to aid with accessibility or to better
      match platform conventions. 
       </th><td headers="td-fa-6 th-fa-dom-rep"> The element. 
      </td></tr><tr>
       <td colspan="2" headers="td-fa-6 th-fa-examples">
        <p class="example" id="example-f0aeeb32"><a class="self-link" href="editing.html#example-f0aeeb32"></a> A user agent could make all list item bullets focusable, so that a user can
      more easily navigate lists. </p>
        <p class="example" id="example-52641c2b"><a class="self-link" href="editing.html#example-52641c2b"></a> Similarly, a user agent could make all elements with <code>title</code> attributes focusable, so that their advisory information can
      be accessed. </p>
    </td></tr></tbody></table>
    <p class="note" role="note"> A <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-5">browsing context container</a> (e.g., an <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-iframe" id="ref-for-elementdef-iframe-53">iframe</a></code>) is a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-12">focusable area</a>, but key events routed to a <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-6">browsing context
    container</a> get immediately routed to the <a data-link-type="dfn" href="browsers.html#nested-browsing-contexts" id="ref-for-nested-browsing-contexts-42">nested browsing context</a>’s <a data-link-type="dfn" href="browsers.html#active-document" id="ref-for-active-document-28">active
    document</a>. Similarly, in sequential focus navigation a <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-7">browsing context
    container</a> essentially acts merely as a placeholder for its <a data-link-type="dfn" href="browsers.html#nested-browsing-contexts" id="ref-for-nested-browsing-contexts-43">nested browsing context</a>’s <a data-link-type="dfn" href="browsers.html#active-document" id="ref-for-active-document-29">active document</a>. </p>
    <p>Each <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-13">focusable area</a> belongs to a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="control-group">control group</dfn>. Each <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-3">control group</a> has
  an <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="owner">owner</dfn>. <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-2">Control group
  owners</a> are <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="control group owner|control group owner objects|control group owner object" data-noexport="" id="control-group-owner">control group owner objects</dfn>. The
  following are <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-3">control group owner objects</a>:</p>
    <ul class="brief">
     <li><code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code> object that have <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-79">browsing contexts</a>.
     </li><li><code><a data-link-type="element" href="interactive-elements.html#elementdef-dialog" id="ref-for-elementdef-dialog-37">dialog</a></code> elements that have an <code>open</code> attribute specified and that are <a data-link-type="dfn" href="rendering.html#being-rendered" id="ref-for-being-rendered-17">being rendered</a>.
    </li></ul>
    <p>Each <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-4">control group owner object</a> owns one <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-4">control group</a> (though that group might be
  empty).</p>
    <p>If the <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-8">DOM anchor</a> of a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-14">focusable area</a> is a <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-5">control group owner
  object</a>, then that <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-15">focusable area</a> belongs to that <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-6">control group owner
  object</a>’s <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-5">control group</a>. Otherwise, the <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-16">focusable area</a> belongs to its <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-9">DOM anchor</a>’s nearest ancestor <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-7">control group owner object</a>.</p>
    <div class="example" id="example-cad4a15f"><a class="self-link" href="editing.html#example-cad4a15f"></a> Thus, a <a data-link-type="dfn" href="infrastructure.html#viewport" id="ref-for-viewport-28">viewport</a> always belongs to the <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-6">control group</a> of the <code>Document</code> for which the <a data-link-type="dfn" href="infrastructure.html#viewport" id="ref-for-viewport-29">viewport</a> was created, an <code><a data-link-type="element" href="sec-forms.html#elementdef-input" id="ref-for-elementdef-input-282">input</a></code> control belongs to the <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-7">control
    group</a> of its nearest ancestor <code><a data-link-type="element" href="interactive-elements.html#elementdef-dialog" id="ref-for-elementdef-dialog-38">dialog</a></code> or <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>, and an image
    map’s shapes belong to the nearest ancestor <code>dialog</code> or <code>Document</code> of the <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-img" id="ref-for-elementdef-img-145">img</a></code> elements (not the <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-area" id="ref-for-elementdef-area-83">area</a></code> elements — this means one <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-area" id="ref-for-elementdef-area-84">area</a></code> element might create multiple shapes in different <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-8">control groups</a>). </div>
    <p>An element is <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="expressly-inert">expressly inert</dfn> if it is <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-21">inert</a> but it is not a <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-8">control group owner object</a> and its nearest
  ancestor <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-9">control group owner object</a> is not <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-22">inert</a>.</p>
    <p>One <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-17">focusable area</a> in each non-empty <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-9">control group</a> is designated the <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="focused area|focused area of the control group|focused dialog|focused area of that focus group|focused area of a control group|focused dialog of a dialog group|focused dialog of its dialog group" data-noexport="" id="focused-area">focused area of the control group</dfn>. Which control is so designated changes over time,
  based on algorithms in this specification. If a <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-10">control group</a> is empty, it has no <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-1">focused area</a>.</p>
    <p>Each <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-10">control group owner object</a> can also act as the <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="dialog group manager|manager" data-noexport="" id="dialog-group-manager">manager</dfn> of a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="dialog-group">dialog group</dfn>.</p>
    <p>Each <code><a data-link-type="element" href="interactive-elements.html#elementdef-dialog" id="ref-for-elementdef-dialog-39">dialog</a></code> element that has an <code>open</code> attribute specified and that is <a data-link-type="dfn" href="rendering.html#being-rendered" id="ref-for-being-rendered-18">being rendered</a> (i.e., that is a <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-11">control group
  owner object</a>) and is not <a data-link-type="dfn" href="editing.html#dialog-expressly-inert" id="ref-for-dialog-expressly-inert-1">expressly inert</a> belongs to the <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-1">dialog group</a> whose <a data-link-type="dfn" href="editing.html#dialog-group-manager" id="ref-for-dialog-group-manager-1">manager</a> is
  the <code><a data-link-type="element" href="interactive-elements.html#elementdef-dialog" id="ref-for-elementdef-dialog-40">dialog</a></code> element’s nearest ancestor <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-12">control group owner object</a>.</p>
    <p>A <code>dialog</code> is <dfn class="dfn-paneled" data-dfn-for="dialog" data-dfn-type="dfn" data-noexport="" id="dialog-expressly-inert">expressly inert</dfn> if it is <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-23">inert</a> but its nearest ancestor <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-13">control group owner object</a> is not.</p>
    <p>If no <code><a data-link-type="element" href="interactive-elements.html#elementdef-dialog" id="ref-for-elementdef-dialog-41">dialog</a></code> element has a particular <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-14">control group owner object</a> as
  its nearest ancestor <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-15">control group owner object</a>, then that <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-16">control group owner
  object</a> has no <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-2">dialog group</a>.</p>
    <p>Each <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-3">dialog group</a> can have a <code>dialog</code> designated as the <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="focused dialog of the dialog group" data-noexport="" id="focused-dialog-of-the-dialog-group">focused
  dialog of the dialog group</dfn>. Which <code>dialog</code> is so designated changes over time,
  based on algorithms in this specification.</p>
    <hr>
    <p><a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-18">Focusable areas</a> in <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-11">control groups</a> are ordered relative to the <a data-link-type="dfn" href="infrastructure.html#tree-order" id="ref-for-tree-order-67">tree order</a> of their <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-10">DOM
  anchors</a>. <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-19">Focusable areas</a> with the same <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-11">DOM anchor</a> in a <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-12">control group</a> are ordered relative to their CSS box’s relative positions in a pre-order,
  depth-first traversal of the box tree. <a data-link-type="biblio" href="references.html#biblio-css-2015">[CSS-2015]</a></p>
    <p>Elements in <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-4">dialog groups</a> are ordered in <a data-link-type="dfn" href="infrastructure.html#tree-order" id="ref-for-tree-order-68">tree
  order</a>.</p>
    <hr>
    <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="currently focused area of the top-level browsing context|currently focused area of a top-level browsing context" data-noexport="" id="currently-focused-area-of-the-top-level-browsing-context">currently focused area of a top-level browsing context</dfn> at any particular time is
  the <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-20">focusable area</a> or <code>dialog</code> returned by this algorithm:</p>
    <ol>
     <li>Let <var>candidate</var> be the <code>Document</code> of the <a data-link-type="dfn" href="browsers.html#top-level-browsing-context" id="ref-for-top-level-browsing-context-10">top-level
    browsing context</a>.
     </li><li>
      <p>If <var>candidate</var> has a <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-5">dialog group</a> with a designated <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-1">focused dialog of the dialog group</a>, then let <var>candidate</var> be the
    designated <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-2">focused dialog of the dialog group</a>, and redo this step.</p>
      <p>Otherwise, if <var>candidate</var> has a non-empty <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-13">control group</a>, and the
    designated <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-2">focused area of the control group</a> is a <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-8">browsing context
    container</a>, then let <var>candidate</var> be the <a data-link-type="dfn" href="browsers.html#active-document" id="ref-for-active-document-30">active document</a> of
    that <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-9">browsing context container</a>’s <a data-link-type="dfn" href="browsers.html#nested-browsing-contexts" id="ref-for-nested-browsing-contexts-44">nested browsing context</a>, and redo
    this step.</p>
      <p>Otherwise, if <var>candidate</var> has a non-empty <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-14">control group</a>, let <var>candidate</var> be the designated <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-3">focused area of the control
    group</a>.</p>
     </li><li>Return <var>candidate</var>.
    </li></ol>
    <p>An element that is the <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-12">DOM anchor</a> of a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-21">focusable area</a> is said to <dfn data-dfn-type="dfn" data-noexport="" id="gain-focus">gain focus<a class="self-link" href="editing.html#gain-focus"></a></dfn> when that <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-22">focusable area</a> becomes the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-2">currently focused area of a
  top-level browsing context</a>. When an element is the <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-13">DOM anchor</a> of a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-23">focusable area</a> of the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-3">currently focused area of a top-level browsing context</a>, it is <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="focused">focused</dfn>.</p>
    <div class="impl">
      The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="focus-chain">focus chain</dfn> of a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-24">focusable area</a> or <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-17">control group owner object</a> <var>subject</var> is the ordered list constructed as follows: 
     <ol>
      <li>Let <var>current object</var> be <var>subject</var>.
      </li><li>Let <var>output</var> be an empty list.
      </li><li><i>Loop</i>: Append <var>current object</var> to <var>output</var>.
      </li><li>
       <p>If <var>current object</var> is an <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-area" id="ref-for-elementdef-area-85">area</a></code> element’s shape, append
    that <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-area" id="ref-for-elementdef-area-86">area</a></code> element to <var>output</var>.</p>
       <p>Otherwise, if <var>current object</var> is a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-25">focusable area</a> whose <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-14">DOM
    anchor</a> is an element that is not <var>current object</var> itself, append that <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-15">DOM anchor</a> element to <var>output</var>.</p>
      </li><li>
       <p>If <var>current object</var> is a <code>dialog</code> object in a <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-6">dialog group</a>,
    let <var>current object</var> be that <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-7">dialog group</a>’s <a data-link-type="dfn" href="editing.html#dialog-group-manager" id="ref-for-dialog-group-manager-2">manager</a>, and return to the step labeled <i>loop</i>.</p>
       <p>Otherwise, if <var>current object</var> is a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-26">focusable area</a>, let <var>current
    object</var> be that <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-27">focusable area</a>’s <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-15">control group</a>’s <a data-link-type="dfn" href="editing.html#owner" id="ref-for-owner-1">owner</a>, and return to the step labeled <i>loop</i>.</p>
       <p>Otherwise, if <var>current object</var> is a <code>Document</code> in a <a data-link-type="dfn" href="browsers.html#nested-browsing-contexts" id="ref-for-nested-browsing-contexts-45">nested browsing context</a>, let <var>current object</var> be its <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-10">browsing context container</a>,
    and return to the step labeled <i>loop</i>.</p>
      </li><li>
       <p>Return <var>output</var>.</p>
       <p class="note" role="note"> The chain starts with <var>subject</var> and (if <var>subject</var> is or can be the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-4">currently focused area of a top-level browsing context</a>) continues up the focus
      hierarchy up to the <code>Document</code> of the <a data-link-type="dfn" href="browsers.html#top-level-browsing-context" id="ref-for-top-level-browsing-context-11">top-level browsing context</a>. </p>
     </li></ol>
    </div>
    <h4 class="heading settled" data-level="5.4.3" id="the-tabindex-attribute"><span class="secno">5.4.3. </span><span class="content">The <code>tabindex</code> attribute</span><a class="self-link" href="editing.html#the-tabindex-attribute"></a></h4>
    <p>The <dfn class="dfn-paneled" data-dfn-for="global" data-dfn-type="element-attr" data-export="" id="element-attrdef-global-tabindex"><code>tabindex</code></dfn> content attribute allows authors to
  indicate that an element is supposed to be <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-28">focusable</a>, and
  whether it is supposed to be reachable using <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-1">sequential focus navigation</a> and, if so,
  what is to be the relative order of the element for the purposes of sequential focus navigation.
  The name "tab index" comes from the common use of the "tab" key to navigate through the focusable
  elements. The term "tabbing" refers to moving forward through the focusable elements that can be
  reached using sequential focus navigation.</p>
    <p>When the attribute is omitted, the user agent applies defaults. (There is no way to make an
  element that is <a data-link-type="dfn" href="rendering.html#being-rendered" id="ref-for-being-rendered-19">being rendered</a> be not focusable at all without <a data-link-type="dfn" href="disabled-elements.html#disabling" id="ref-for-disabling-5">disabling</a> it or making it <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-24">inert</a>.)</p>
    <p>The <code>tabindex</code> attribute, if specified, must have a value
  that is a <a data-link-type="dfn" href="infrastructure.html#valid-integer" id="ref-for-valid-integer-15">valid integer</a>. Positive numbers specify the relative position of the
  element’s <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-29">focusable areas</a> in the <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-2">sequential focus
  navigation order</a>, and negative numbers indicate that the control is to be unreachable by <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-3">sequential focus navigation</a>.</p>
    <div class="impl">
     <p>Each element can have a <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="can be focused|tabindex focus flag" data-noexport="" id="can-be-focused">tabindex focus flag</dfn> set, as defined
  below. This flag is a factor that contributes towards determining whether an element is a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-30">focusable area</a>, as described in the previous section.</p>
     <p>If the <code>tabindex</code> attribute is specified on an element, it
  must be parsed using the <a data-link-type="dfn" href="infrastructure.html#parse-token-as-an-integer" id="ref-for-parse-token-as-an-integer-7">rules for parsing integers</a>. The attribute’s values, or lack
  thereof, must be interpreted as follows:</p>
     <dl>
      <dt>If the attribute is omitted or parsing the value returns an error
      </dt><dd>
       <p>The user agent should follow platform conventions to determine if the element’s <a data-link-type="dfn" href="editing.html#can-be-focused" id="ref-for-can-be-focused-4">tabindex focus flag</a> is set and, if so, whether the element and any <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-31">focusable areas</a> that have the element as their <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-16">DOM anchor</a> can
    be reached using <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-4">sequential focus navigation</a>, and if so, what their relative
    position in the <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-5">sequential focus navigation order</a> is to be.</p>
       <p>Modulo platform conventions, it is suggested that for the following elements, the <a data-link-type="dfn" href="editing.html#can-be-focused" id="ref-for-can-be-focused-5">tabindex focus flag</a> be set:</p>
       <ul>
        <li><code><a data-link-type="element" href="textlevel-semantics.html#elementdef-a" id="ref-for-elementdef-a-89">a</a></code> elements that have an <code><a data-link-type="element-sub" href="links.html#element-attrdef-a-href" id="ref-for-element-attrdef-a-href-31">href</a></code> attribute
        </li><li><code><a data-link-type="element" href="document-metadata.html#elementdef-link" id="ref-for-elementdef-link-64">link</a></code> elements that have an <code><a data-link-type="element-sub" href="document-metadata.html#element-attrdef-link-href" id="ref-for-element-attrdef-link-href-8">href</a></code> attribute
        </li><li><code><a data-link-type="element" href="sec-forms.html#elementdef-button" id="ref-for-elementdef-button-39">button</a></code> elements
        </li><li><code><a data-link-type="element" href="sec-forms.html#elementdef-input" id="ref-for-elementdef-input-283">input</a></code> elements whose <code><a data-link-type="element-sub" href="sec-forms.html#element-attrdef-input-type" id="ref-for-element-attrdef-input-type-139">type</a></code> attribute are
      not in the <a data-link-type="dfn" href="editing.html#hidden" id="ref-for-hidden-16">Hidden</a> state
        </li><li><code><a data-link-type="element" href="sec-forms.html#elementdef-select" id="ref-for-elementdef-select-105">select</a></code> elements
        </li><li><code><a data-link-type="element" href="sec-forms.html#elementdef-textarea" id="ref-for-elementdef-textarea-76">textarea</a></code> elements
        </li><li><code><a data-link-type="element" href="interactive-elements.html#elementdef-menuitem" id="ref-for-elementdef-menuitem-21">menuitem</a></code> elements
        </li><li>Elements with a <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-draggable" id="ref-for-element-attrdef-global-draggable-2">draggable</a></code> attribute set, if that would
      enable the user agent to allow the user to begin a drag operations for those elements without
      the use of a pointing device
        </li><li><a data-link-type="dfn" href="editing.html#editing-host" id="ref-for-editing-host-2">Editing hosts</a>
        </li><li><a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-11">Browsing context containers</a>
       </li></ul>
       <p class="note" role="note"> One valid reason to ignore the platform conventions and always allow an element
    to be focused (by setting its <a data-link-type="dfn" href="editing.html#can-be-focused" id="ref-for-can-be-focused-6">tabindex focus flag</a>) would be if the user’s only
    mechanism for activating an element is through a keyboard action that triggers the focused
    element. </p>
      </dd><dt>If the value is a negative integer
      </dt><dd>
       <p>The user agent must set the element’s <a data-link-type="dfn" href="editing.html#can-be-focused" id="ref-for-can-be-focused-7">tabindex focus flag</a>, but should omit the
    element from the <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-6">sequential focus navigation order</a>.</p>
       <p class="note" role="note"> One valid reason to ignore the requirement that sequential focus navigation not
    allow the author to lead to the element would be if the user’s only mechanism for moving the
    focus is sequential focus navigation. For instance, a keyboard-only user would be unable to
    click on a text field with a negative <code>tabindex</code>, so that
    user’s user agent would be well justified in allowing the user to tab to the control
    regardless. </p>
      </dd><dt>If the value is a zero
      </dt><dd>
       <p>The user agent must set the element’s <a data-link-type="dfn" href="editing.html#can-be-focused" id="ref-for-can-be-focused-8">tabindex focus flag</a>, should allow the
    element and any <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-32">focusable areas</a> that have the element as their <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-17">DOM anchor</a> to be reached using <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-7">sequential focus navigation</a>, following
    platform conventions to determine the element’s relative position in the <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-8">sequential focus
    navigation order</a>.</p>
      </dd><dt>If the value is greater than zero
      </dt><dd>
       <p>The user agent must set the element’s <a data-link-type="dfn" href="editing.html#can-be-focused" id="ref-for-can-be-focused-9">tabindex focus flag</a>, should allow the
    element and any <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-33">focusable areas</a> that have the element as their <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-18">DOM anchor</a> to be reached using sequential focus navigation, and should place the element
    — referenced as <var>candidate</var> below — and the aforementioned <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-34">focusable areas</a> in the <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-9">sequential focus navigation</a> order so that, relative to other <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-35">focusable areas</a> in the <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-10">sequential focus navigation order</a>, they are:</p>
       <ul>
        <li>before any <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-36">focusable area</a> whose <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-19">DOM anchor</a> is an element whose <code>tabindex</code> attribute has been omitted or whose value, when parsed,
      returns an error,
        </li><li>before any <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-37">focusable area</a> whose <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-20">DOM anchor</a> is an element whose <code>tabindex</code> attribute has a value equal to or less than zero,
        </li><li>after any <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-38">focusable area</a> whose <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-21">DOM anchor</a> is an element whose <code>tabindex</code> attribute has a value greater than zero but less than
      the value of the <code>tabindex</code> attribute on <var>candidate</var>,
        </li><li>after any <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-39">focusable area</a> whose <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-22">DOM anchor</a> is an element whose <code>tabindex</code> attribute has a value equal to the value of the <code>tabindex</code> attribute on <var>candidate</var> but that is
      earlier in the document in <a data-link-type="dfn" href="infrastructure.html#tree-order" id="ref-for-tree-order-69">tree order</a> than <var>candidate</var>,
        </li><li>before any <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-40">focusable area</a> whose <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-23">DOM anchor</a> is an element whose <code>tabindex</code> attribute has a value equal to the value of the <code>tabindex</code> attribute on <var>candidate</var> but that is
      later in the document in <a data-link-type="dfn" href="infrastructure.html#tree-order" id="ref-for-tree-order-70">tree order</a> than <var>candidate</var>, and
        </li><li>before any <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-41">focusable area</a> whose <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-24">DOM anchor</a> is an element whose <code>tabindex</code> attribute has a value greater than the value of the <code>tabindex</code> attribute on <var>candidate</var>.
       </li></ul>
     </dd></dl>
     <p>An element that has its <a data-link-type="dfn" href="editing.html#can-be-focused" id="ref-for-can-be-focused-10">tabindex focus flag</a> set but does not otherwise have an <a data-link-type="dfn" href="editing.html#activation-behavior" id="ref-for-activation-behavior-46">activation behavior</a> defined has an <a data-link-type="dfn" href="editing.html#activation-behavior" id="ref-for-activation-behavior-47">activation behavior</a> that does
  nothing.</p>
     <p class="note" role="note"> This means that an element that is only focusable because of its <code>tabindex</code> attribute will fire a <code>click</code> event in response to a non-mouse activation (e.g., hitting the
  "enter" key while the element is <a data-link-type="dfn" href="editing.html#focused" id="ref-for-focused-10">focused</a>). </p>
     <p>An element with the <code>tabindex</code> attribute specified is <a data-link-type="dfn" href="dom.html#interactive-content" id="ref-for-interactive-content-22">interactive content</a>.</p>
     <p>The <dfn class="idl-code" data-dfn-for="global" data-dfn-type="attribute" data-export="" id="dom-global-tabindex"><code>tabIndex</code><a class="self-link" href="editing.html#dom-global-tabindex"></a></dfn> IDL attribute must <a data-link-type="dfn" href="infrastructure.html#reflection" id="ref-for-reflection-117">reflect</a> the value of the <code>tabindex</code> content
  attribute. Its default value is 0 for elements that are focusable and -1 for elements that
  are not focusable.</p>
     <p class="warning"> Most current browsers instead give the <code class="idl"><a data-link-type="idl" href="dom.html#dom-htmlelement-tabindex" id="ref-for-dom-htmlelement-tabindex-1">tabIndex</a></code> IDL attribute a value of 0 for some list of elements that are by default a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-42">focusable area</a>, and -1 for other elements, if there is no <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-tabindex" id="ref-for-element-attrdef-global-tabindex-1">tabindex</a></code> content attribute set. This behaviour is not well-defined and will hopefully be improved in the future.</p>
    </div>
    <div class="impl">
     <h4 class="heading settled" data-level="5.4.4" id="focus-processing-model"><span class="secno">5.4.4. </span><span class="content">Processing model</span><a class="self-link" href="editing.html#focus-processing-model"></a></h4>
     <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="focusing-steps">focusing steps</dfn> for an object <var>new focus target</var> that is
  either a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-43">focusable area</a>, or an element that is not a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-44">focusable area</a>, or a <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-80">browsing context</a>, are as follows. They can optionally be run with a <i>fallback target</i>.</p>
     <ol>
      <li>
       <p>If <var>new focus target</var> is neither a <code><a data-link-type="element" href="interactive-elements.html#elementdef-dialog" id="ref-for-elementdef-dialog-42">dialog</a></code> element that has an <code>open</code> attribute specified and that is <a data-link-type="dfn" href="rendering.html#being-rendered" id="ref-for-being-rendered-20">being
    rendered</a> (i.e., that is a <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-18">control group owner object</a>), nor a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-45">focusable
    area</a>, then run the first matching set of steps from the following list:</p>
       <dl class="switch">
        <dt>If <var>new focus target</var> is an <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-area" id="ref-for-elementdef-area-87">area</a></code> element with one or more
      shapes that are <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-46">focusable areas</a>
        </dt><dd>
         <p>Let <var>new focus target</var> be the shape corresponding to the first <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-img" id="ref-for-elementdef-img-146">img</a></code> element in <a data-link-type="dfn" href="infrastructure.html#tree-order" id="ref-for-tree-order-71">tree order</a> that uses the image map to which the <code>area</code> element belongs.</p>
        </dd><dt>If <var>new focus target</var> is an element with one or more scrollable regions
      that are <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-47">focusable areas</a>
        </dt><dd>
         <p>Let <var>new focus target</var> be the element’s first scrollable region,
      according to a pre-order, depth-first traversal of the box tree. <a data-link-type="biblio" href="references.html#biblio-css-2015">[CSS-2015]</a></p>
        </dd><dt>If <var>new focus target</var> is the <a data-link-type="dfn" href="infrastructure.html#root-element" id="ref-for-root-element-24">root element</a> of its <code>Document</code>
        </dt><dd>
         <p>Let <var>new focus target</var> be the <code>Document</code>’s <a data-link-type="dfn" href="infrastructure.html#viewport" id="ref-for-viewport-30">viewport</a>.</p>
        </dd><dt>If <var>new focus target</var> is a <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-81">browsing context</a>
        </dt><dd>
         <p>Let <var>new focus target</var> be the <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-82">browsing context</a>’s <a data-link-type="dfn" href="browsers.html#active-document" id="ref-for-active-document-31">active document</a>.</p>
        </dd><dt>If <var>new focus target</var> is a <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-12">browsing context container</a>
        </dt><dd>
         <p>Let <var>new focus target</var> be the <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-13">browsing context container</a>’s <a data-link-type="dfn" href="browsers.html#nested-browsing-contexts" id="ref-for-nested-browsing-contexts-46">nested browsing context</a>’s <a data-link-type="dfn" href="browsers.html#active-document" id="ref-for-active-document-32">active document</a>.</p>
        </dd><dt>Otherwise
        </dt><dd>
         <p>If no <i>fallback target</i> was specified, abort the <a data-link-type="dfn" href="editing.html#focusing-steps" id="ref-for-focusing-steps-7">focusing steps</a>.</p>
         <p>Otherwise, let <var>new focus target</var> be the <i>fallback target</i>.</p>
       </dd></dl>
      </li><li>
       <p>If <var>new focus target</var> is a <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-19">control group owner object</a> that is
    not a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-48">focusable area</a>, but does have a <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-8">dialog group</a>, and that <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-9">dialog group</a> has a designated <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-4">focused dialog</a>, then
    let <var>new focus target</var> be the <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-3">focused dialog of the dialog
    group</a>, and redo this step.</p>
       <p>Otherwise, if <var>new focus target</var> is a <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-20">control group owner
    object</a> that is not a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-49">focusable area</a>, and its <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-16">control group</a> is not empty,
    then designate <var>new focus target</var> as the <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-5">focused area of the control
    group</a>, and redo this step.</p>
       <p>Otherwise, if <var>new focus target</var> is a <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-14">browsing context
    container</a>, then let <var>new focus target</var> be the <a data-link-type="dfn" href="browsers.html#nested-browsing-contexts" id="ref-for-nested-browsing-contexts-47">nested browsing context</a>’s <a data-link-type="dfn" href="browsers.html#active-document" id="ref-for-active-document-33">active document</a>, and redo this step.</p>
       <p class="note" role="note"> A <code><a data-link-type="element" href="interactive-elements.html#elementdef-dialog" id="ref-for-elementdef-dialog-43">dialog</a></code> element can be both a <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-21">control group owner
    object</a> and a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-50">focusable area</a>, if it has both an <code>open</code> attribute specified and a <code>tabindex</code> attribute specified and is <a data-link-type="dfn" href="rendering.html#being-rendered" id="ref-for-being-rendered-21">being
    rendered</a>. </p>
      </li><li>If <var>new focus target</var> is a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-51">focusable area</a> and its <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-25">DOM
    anchor</a> is <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-25">inert</a>, then abort these steps.
      </li><li>If <var>new focus target</var> is the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-5">currently focused area of a
    top-level browsing context</a>, then abort these steps.
      </li><li>Let <var>old chain</var> be the <a data-link-type="dfn" href="editing.html#focus-chain" id="ref-for-focus-chain-2">focus chain</a> of the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-6">currently focused area of the
    top-level browsing context</a> in which <var>new focus target</var> finds
    itself.
      </li><li>Let <var>new chain</var> be the <a data-link-type="dfn" href="editing.html#focus-chain" id="ref-for-focus-chain-3">focus chain</a> of <var>new
    focus target</var>.
      </li><li>Run the <a data-link-type="dfn" href="editing.html#loses-focus" id="ref-for-loses-focus-3">focus update steps</a> with <var>old chain</var>, <var>new chain</var>, and <var>new focus target</var> respectively.
     </li></ol>
     <p>User agents must <a data-link-type="dfn" href="infrastructure.html#immediately" id="ref-for-immediately-10">immediately</a> run the <a data-link-type="dfn" href="editing.html#focusing-steps" id="ref-for-focusing-steps-8">focusing steps</a> for a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-52">focusable area</a>, <code><a data-link-type="element" href="interactive-elements.html#elementdef-dialog" id="ref-for-elementdef-dialog-44">dialog</a></code>, or <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-83">browsing context</a> <var>candidate</var> whenever the
  user attempts to move the focus to <var>candidate</var>.</p>
     <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="unfocusing-steps">unfocusing steps</dfn> for an object <var>old focus target</var> that is
  either a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-53">focusable area</a> or an element that is not a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-54">focusable area</a> are as
  follows:</p>
     <ol>
      <li>If <var>old focus target</var> is <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-26">inert</a>, then abort these
    steps.
      </li><li>
       <p>If <var>old focus target</var> is an <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-area" id="ref-for-elementdef-area-88">area</a></code> element and one of its shapes is the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-7">currently focused area of a top-level browsing context</a>, or, if <var>old focus
    target</var> is an element with one or more scrollable regions, and one of them is the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-8">currently focused area of a top-level browsing context</a>, then let <var>old focus
    target</var> be that <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-9">currently focused area of a top-level browsing context</a>.</p>
      </li><li>Let <var>old chain</var> be the <a data-link-type="dfn" href="editing.html#focus-chain" id="ref-for-focus-chain-4">focus chain</a> of the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-10">currently
    focused area of a top-level browsing context</a>.
      </li><li>If <var>old focus target</var> is not one of the entries in <var>old
    chain</var>, then abort these steps.
      </li><li>
       <p>If <var>old focus target</var> is a <code>dialog</code> in a <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-10">dialog group</a>, and
    the <a data-link-type="dfn" href="editing.html#dialog-group-manager" id="ref-for-dialog-group-manager-3">dialog group manager</a> has a non-empty <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-17">control group</a>, then let <var>new focus target</var> be the designated <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-6">focused area of that focus group</a>.</p>
       <p>Otherwise, if <var>old focus target</var> is a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-55">focusable area</a>, then let <var>new
    focus target</var> be the first <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-56">focusable area</a> of its <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-18">control group</a> (if the <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-22">control group owner</a> is a <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>, this will always be a <a data-link-type="dfn" href="infrastructure.html#viewport" id="ref-for-viewport-31">viewport</a>).</p>
       <p>Otherwise, let <var>new focus target</var> be null.</p>
      </li><li>If <var>new focus target</var> is not null, then run the <a data-link-type="dfn" href="editing.html#focusing-steps" id="ref-for-focusing-steps-9">focusing
    steps</a> for <var>new focus target</var>.
     </li></ol>
     <p>When the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-11">currently focused area of a top-level browsing context</a> is somehow
  unfocused without another element being explicitly focused in its stead, the user agent must <a data-link-type="dfn" href="infrastructure.html#immediately" id="ref-for-immediately-11">immediately</a> run the <a data-link-type="dfn" href="editing.html#unfocusing-steps" id="ref-for-unfocusing-steps-1">unfocusing steps</a> for that object.</p>
     <p class="note" role="note"> The <a data-link-type="dfn" href="editing.html#unfocusing-steps" id="ref-for-unfocusing-steps-2">unfocusing steps</a> do not always result in the focus changing, even
  when applied to the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-12">currently focused area of a top-level browsing context</a>. For
  example, if the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-13">currently focused area of a top-level browsing context</a> is a <a data-link-type="dfn" href="infrastructure.html#viewport" id="ref-for-viewport-32">viewport</a>,
  then it will usually keep its focus regardless until another <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-57">focusable area</a> is explicitly
  focused with the <a data-link-type="dfn" href="editing.html#focusing-steps" id="ref-for-focusing-steps-10">focusing steps</a>. </p>
     <hr>
     <p>When a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-58">focusable area</a> is added to an empty <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-19">control group</a>, it must be designated
  the <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-7">focused area of the control group</a>.</p>
     <p>When a <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-11">dialog group</a> is formed, if the <a data-link-type="dfn" href="editing.html#dialog-group-manager" id="ref-for-dialog-group-manager-4">dialog group manager</a> has an empty <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-20">control group</a>, the first non-<a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-27">inert</a> <code>dialog</code> in the <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-12">dialog
  group</a>, if any, or else the first <code>dialog</code> in the <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-13">dialog group</a> regardless of <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-28">inertness</a>, must be designated the <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-4">focused dialog of the dialog
  group</a>.</p>
     <p><dfn data-dfn-type="dfn" data-noexport="" id="focus-fixup-rule-one">Focus fixup rule one<a class="self-link" href="editing.html#focus-fixup-rule-one"></a></dfn>: When the designated <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-8">focused area of a control group</a> is removed from that <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-21">control group</a> in
  some way (e.g., it stops being a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-59">focusable area</a>, it is removed from the DOM, it
  becomes <a data-link-type="dfn" href="editing.html#expressly-inert" id="ref-for-expressly-inert-5">expressly inert</a>, etc), and the <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-22">control
  group</a> is still not empty: designate the first non-<a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-29">inert</a> <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-9">focused area</a> in that <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-23">control group</a> to be the new <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-10">focused area of the control group</a>, if any; if they are all <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-30">inert</a>, then
  designate the first <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-11">focused area</a> in that <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-24">control group</a> to be the new <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-12">focused area of the control group</a> regardless
  of <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-31">inertness</a>. If such a removal instead results in the <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-25">control
  group</a> being empty, then there is simply no longer a <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-13">focused area of the control
  group</a>.</p>
     <p class="example" id="example-5ec11306"><a class="self-link" href="editing.html#example-5ec11306"></a> For example, this might happen because an element is removed from its <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>, or has a <code>hidden</code> attribute added. It might
  also happen to an <code><a data-link-type="element" href="sec-forms.html#elementdef-input" id="ref-for-elementdef-input-284">input</a></code> element when the element gets disabled. </p>
     <p><dfn data-dfn-type="dfn" data-noexport="" id="focus-fixup-rule-two">Focus fixup rule two<a class="self-link" href="editing.html#focus-fixup-rule-two"></a></dfn>: When a <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-14">dialog group</a> has no designed <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-5">focused
  dialog of the dialog group</a>, and its <a data-link-type="dfn" href="editing.html#dialog-group-manager" id="ref-for-dialog-group-manager-5">dialog group manager</a>’s <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-26">control
  group</a> changes from being non-empty to being empty, the first non-<a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-32">inert</a> <code>dialog</code> in the <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-15">dialog group</a>, if any, or else the first <code>dialog</code> in
  the <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-16">dialog group</a> regardless of <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-33">inertness</a>, must be designated
  the <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-6">focused dialog of the dialog group</a>.</p>
     <p><dfn data-dfn-type="dfn" data-noexport="" id="focus-fixup-rule-three">Focus fixup rule three<a class="self-link" href="editing.html#focus-fixup-rule-three"></a></dfn>: When the designated <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-14">focused dialog of a dialog group</a> is removed from that <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-17">dialog group</a> in
  some way (e.g., it stops <a data-link-type="dfn" href="rendering.html#being-rendered" id="ref-for-being-rendered-22">being rendered</a>, it loses its <code>open</code> attribute, it becomes <a data-link-type="dfn" href="editing.html#expressly-inert" id="ref-for-expressly-inert-6">expressly inert</a>, etc), and there is still a <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-18">dialog group</a> (because the <code>dialog</code> in question was not the last <code>dialog</code> in that <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-19">dialog group</a>):
  if the <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-20">dialog group</a>’s <a data-link-type="dfn" href="editing.html#dialog-group-manager" id="ref-for-dialog-group-manager-6">manager</a>’s <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-27">control
  group</a> is non-empty, let there be no designated <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-7">focused dialog of the dialog group</a> any more; otherwise (in the case that the <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-28">control group</a> is empty), designate the first
  non-<a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-34">inert</a> <code>dialog</code> in the <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-21">dialog group</a> to be the <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-8">focused
  dialog of the dialog group</a>, or, if they are all <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-35">inert</a>, designate the first <code>dialog</code> in the <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-22">dialog group</a> to be the <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-9">focused dialog of the dialog
  group</a> regardless of <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-36">inertness</a>.</p>
     <p>When the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-14">currently focused area of a top-level browsing context</a> was a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-60">focusable
  area</a> but stops being a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-61">focusable area</a>, or when it was a <code>dialog</code> in a <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-23">dialog group</a> and stops being part of that <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-24">dialog group</a>, or when it
  starts being <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-37">inert</a>, the user agent must run the following steps:</p>
     <ol>
      <li>Let <var>old focus target</var> be whatever the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-15">currently focused area of the top-level browsing
    context</a> was immediately before this algorithm became applicable (e.g., before the element
    was disabled, or the dialog was closed, or whatever caused this algorithm to run).
      </li><li>Let <var>old chain</var> be the <a data-link-type="dfn" href="editing.html#focus-chain" id="ref-for-focus-chain-5">focus chain</a> of the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-16">currently focused area of the
    top-level browsing context</a> at the same time.
      </li><li>Make sure that the changes implied by the focus fixup rules <span>one</span>, <span>two</span>, and <span>three</span> above are applied.
      </li><li>Let <var>new focus target</var> be the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-17">currently focused area of a
    top-level browsing context</a>.
      </li><li>If <var>old focus target</var> and <var>new focus target</var> are the
    same, abort these steps.
      </li><li>Let <var>new chain</var> be the <a data-link-type="dfn" href="editing.html#focus-chain" id="ref-for-focus-chain-6">focus chain</a> of <var>new
    focus target</var>.
      </li><li>Run the <a data-link-type="dfn" href="editing.html#loses-focus" id="ref-for-loses-focus-4">focus update steps</a> with <var>old chain</var>, <var>new chain</var>, and <var>new focus target</var> respectively.
     </li></ol>
     <hr>
     <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="loses focus|focus update steps" data-noexport="" id="loses-focus">focus update steps</dfn>, given an <var>old chain</var>, a <var>new chain</var>, and a <var>new focus target</var> respectively, are as
  follows:</p>
     <ol>
      <li>Unset the <a data-link-type="dfn" href="editing.html#sequential-focus-navigation-starting-point" id="ref-for-sequential-focus-navigation-starting-point-1">sequential focus navigation starting point</a>.
      </li><li>If the last entry in <var>old chain</var> and the last entry in <var>new chain</var> are the same, pop the last entry from <var>old chain</var> and the last entry from <var>new chain</var> and redo this step.
      </li><li>
       <p>For each entry <var>entry</var> in <var>old chain</var>, in order, run
    these substeps:</p>
       <ol>
        <li>If <var>entry</var> is an <code>input</code> element, and the <code>change</code> event <a data-link-type="dfn" href="sec-forms.html#apply" id="ref-for-apply-61">applies</a> to the element, and the element does not have a
      defined <a data-link-type="dfn" href="editing.html#activation-behavior" id="ref-for-activation-behavior-48">activation behavior</a>, and the user has changed the element’s <a data-link-type="dfn" href="sec-forms.html#forms-value" id="ref-for-forms-value-242">value</a> or its list of <a data-link-type="dfn" href="sec-forms.html#selected-files" id="ref-for-selected-files-14">selected files</a> while the control was focused
      without committing that change, then <a data-link-type="dfn" href="infrastructure.html#fire" id="ref-for-fire-143">fire a simple event</a> that bubbles named <code>change</code> at the element. 
        </li><li>
         <p>If <var>entry</var> is an element, let <var>blur event target</var> be <var>entry</var>.</p>
         <p>If <var>entry</var> is a <code>Document</code> object, let <var>blur
      event target</var> be that <code>Document</code> object’s <code>Window</code> object.</p>
         <p>Otherwise, let <var>blur event target</var> be null.</p>
        </li><li>If <var>entry</var> is the last entry in <var>old chain</var>, and <var>entry</var> is an <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#interface-element">Element</a></code>, and the last entry in <var>new
      chain</var> is also an <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#interface-element">Element</a></code>, then let <var>related blur target</var> be the last entry in <var>new chain</var>. Otherwise, let <var>related blur
      target</var> be null.
        </li><li>
         <p>If <var>blur event target</var> is not null, <a data-link-type="dfn" href="editing.html#fire-a-focus-event" id="ref-for-fire-a-focus-event-1">fire a focus event</a> named <code>blur</code> at <var>blur event target</var>, with <var>related blur target</var> as the related target.</p>
         <p class="note" role="note"> In some cases, e.g., if <var>entry</var> is an <code>area</code> element’s shape, a scrollable region, or a <a data-link-type="dfn" href="infrastructure.html#viewport" id="ref-for-viewport-33">viewport</a>, no event is fired. </p>
       </li></ol>
      </li><li>Apply any relevant platform-specific conventions for focusing <var>new focus
    target</var>. (For example, some platforms select the contents of a text field when that field is
    focused.)
      </li><li>
       <p>For each entry <var>entry</var> in <var>new chain</var>, in reverse
    order, run these substeps:</p>
       <ol>
        <li>If <var>entry</var> is a <code><a data-link-type="element" href="interactive-elements.html#elementdef-dialog" id="ref-for-elementdef-dialog-45">dialog</a></code> element: Let <var>entry</var> be the designated <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-15">focused dialog of its dialog group</a>.
        </li><li>
         <p>If <var>entry</var> is a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-62">focusable area</a>: Designate <var>entry</var> as the <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-16">focused area of the control group</a>. If its <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-29">control
      group</a>’s <a data-link-type="dfn" href="editing.html#owner" id="ref-for-owner-2">owner</a> is also a <a data-link-type="dfn" href="editing.html#dialog-group-manager" id="ref-for-dialog-group-manager-7">dialog group
      manager</a>, then let there be no designated <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-17">focused dialog</a> in that <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-25">dialog group</a>.</p>
         <p class="note" role="note"> It is possible for <var>entry</var> to be both a <code>dialog</code> element and a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-63">focusable area</a>, in which case it is its own <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-23">control group
      owner</a>. </p>
        </li><li>
         <p>If <var>entry</var> is an element, let <var>focus event target</var> be <var>entry</var>.</p>
         <p>If <var>entry</var> is a <code>Document</code> object, let <var>focus
      event target</var> be that <code>Document</code> object’s <code>Window</code> object.</p>
         <p>Otherwise, let <var>focus event target</var> be null.</p>
        </li><li>If <var>entry</var> is the last entry in <var>new chain</var>, and <var>entry</var> is an <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#interface-element">Element</a></code>, and the last entry in <var>old
      chain</var> is also an <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#interface-element">Element</a></code>, then let <var>related focus target</var> be the last entry in <var>old chain</var>. Otherwise, let <var>related
      focus target</var> be null.
        </li><li>
         <p>If <var>focus event target</var> is not null, <a data-link-type="dfn" href="editing.html#fire-a-focus-event" id="ref-for-fire-a-focus-event-2">fire a focus event</a> named <code>focus</code> at <var>focus event target</var>, with <var>related focus target</var> as the related target.</p>
         <p class="note" role="note"> In some cases, e.g., if <var>entry</var> is an <code>area</code> element’s shape, a scrollable region, or a <a data-link-type="dfn" href="infrastructure.html#viewport" id="ref-for-viewport-34">viewport</a>, no event is fired. </p>
       </li></ol>
     </li></ol>
     <p>When a user agent is required to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="fire-a-focus-event">fire a focus event</dfn> named <var>e</var> at
  an element <var>t</var> and with a given related target <var>r</var>, the user
  agent must create a <a data-link-type="dfn" href="infrastructure.html#trusted" id="ref-for-trusted-13">trusted</a> <code>FocusEvent</code> object, initialize it to have the given name <var>e</var>, to not bubble, to not be
  cancelable, and to have the <code>relatedTarget</code> attribute initialized to <var>r</var>, the <code>view</code> attribute initialized to the <code>Window</code> object of the <code>Document</code> object of <var>t</var>, and the <code>detail</code> attribute initialized to 0, and must then <a data-link-type="dfn" href="infrastructure.html#dispatch" id="ref-for-dispatch-3">dispatch</a> the newly created <code>FocusEvent</code> object
  at the specified target element <var>t</var>.</p>
     <hr>
     <p>When a key event is to be routed in a <a data-link-type="dfn" href="browsers.html#top-level-browsing-context" id="ref-for-top-level-browsing-context-12">top-level browsing context</a>, the user agent
  must run the following steps:</p>
     <ol>
      <li>Let <var>target area</var> be the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-18">currently focused area of the top-level browsing
    context</a>.
      </li><li>If <var>target area</var> is a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-64">focusable area</a>, let <var>target
    node</var> be <var>target area</var>’s <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-26">DOM anchor</a>. Otherwise, <var>target area</var> is a <code>dialog</code>; let <var>target node</var> be <var>target area</var>.
      </li><li>
       <p>If <var>target node</var> is a <code>Document</code> that has a <code><a data-link-type="element" href="sections.html#elementdef-body" id="ref-for-elementdef-body-55">body</a></code> element, then let <var>target node</var> be <a href="sections.html#the-body-element">the <code>body</code> element</a> of that <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>.</p>
       <p>Otherwise, if <var>target node</var> is a <code>Document</code> that has a <a data-link-type="dfn" href="infrastructure.html#root-element" id="ref-for-root-element-25">root element</a>, then let <var>target node</var> be the <a data-link-type="dfn" href="infrastructure.html#root-element" id="ref-for-root-element-26">root
    element</a> of that <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>.</p>
      </li><li>
       <p>If <var>target node</var> is not <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-38">inert</a>, fire the event at <var>target node</var>.</p>
       <p class="note" role="note"> It is possible for the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-19">currently focused area of a top-level browsing
    context</a> to be <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-39">inert</a>, for example if a <a data-link-type="dfn" href="interactive-elements.html#modal-dialog-is-shown" id="ref-for-modal-dialog-is-shown-1">modal dialog is shown</a>, and then that <code>dialog</code> element is made <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-40">inert</a>. It is likely to be the result of a logic error in the
    application, though. </p>
      </li><li>If the event was not canceled, then let <var>target area</var> handle the key
    event. This might include <a data-link-type="dfn" href="editing.html#running-synthetic-click-activation-steps" id="ref-for-running-synthetic-click-activation-steps-12">running synthetic
    click activation steps</a> for <var>target node</var>.
     </li></ol>
     <hr>
     <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="has-focus-steps">has focus steps</dfn>, given a <code>Document</code> object <var>target</var>, are
  as follows:</p>
     <ol>
      <li>Let <var>candidate</var> be the <code>Document</code> of the <a data-link-type="dfn" href="browsers.html#top-level-browsing-context" id="ref-for-top-level-browsing-context-13">top-level browsing
    context</a>.
      </li><li>If <var>candidate</var> is <var>target</var>, return true and abort these steps.
      </li><li>
       <p>If <var>candidate</var> has a <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-26">dialog group</a> with a designated <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-10">focused
    dialog of the dialog group</a>, then let <var>candidate</var> be the designated <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-11">focused dialog of the dialog group</a>, and redo this step.</p>
       <p>Otherwise, if <var>candidate</var> has a non-empty <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-30">control group</a>, and the
    designated <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-18">focused area of the control group</a> is a <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-15">browsing context
    container</a>, and the <a data-link-type="dfn" href="browsers.html#active-document" id="ref-for-active-document-34">active document</a> of that <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-16">browsing context
    container</a>’s <a data-link-type="dfn" href="browsers.html#nested-browsing-contexts" id="ref-for-nested-browsing-contexts-48">nested browsing context</a> is <var>target</var>, then
    return true and abort these steps.</p>
       <p>Otherwise, if <var>candidate</var> has a non-empty <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-31">control group</a>, and the
    designated <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-19">focused area of the control group</a> is a <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-17">browsing context
    container</a>, then let <var>candidate</var> be the <a data-link-type="dfn" href="browsers.html#active-document" id="ref-for-active-document-35">active document</a> of
    that <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-18">browsing context container</a>’s <a data-link-type="dfn" href="browsers.html#nested-browsing-contexts" id="ref-for-nested-browsing-contexts-49">nested browsing context</a>, and redo
    this step.</p>
       <p>Otherwise, return false and abort these steps.</p>
     </li></ol>
     <h4 class="heading settled" data-level="5.4.5" id="sec-sequential-focus-navigation"><span class="secno">5.4.5. </span><span class="content">Sequential focus navigation</span><a class="self-link" href="editing.html#sec-sequential-focus-navigation"></a></h4>
     <p>Each <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-32">control group</a> has a <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="sequential focus navigation|sequential focus navigation order" data-noexport="" id="sequential-focus-navigation">sequential focus navigation order</dfn>, which orders some
  or all of the <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-65">focusable areas</a> in the <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-33">control group</a> relative to each other. The order in the <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-11">sequential focus navigation order</a> does not
  have to be related to the order in the <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-34">control group</a> itself. If a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-66">focusable area</a> is
  omitted from the <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-12">sequential focus navigation order</a> of its <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-35">control group</a>, then
  it is unreachable via <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-13">sequential focus navigation</a>.</p>
     <p>There can also be a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="sequential-focus-navigation-starting-point">sequential focus navigation starting point</dfn>. It is initially
  unset. The user agent may set it when the user indicates that it should be moved.</p>
     <p class="example" id="example-7f4ad2ac"><a class="self-link" href="editing.html#example-7f4ad2ac"></a> For example, the user agent could set it to the position of the user’s click if
  the user clicks on the document contents. </p>
     <p>When the user requests that focus move from the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-20">currently focused area of a top-level
  browsing context</a> to the next or previous <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-67">focusable area</a> (e.g., as the default action
  of pressing the <kbd>tab</kbd> key), or when the user requests that focus sequentially move to a <a data-link-type="dfn" href="browsers.html#top-level-browsing-context" id="ref-for-top-level-browsing-context-14">top-level browsing context</a> in the first place (e.g., from the browser’s location bar),
  the user agent must use the following algorithm:</p>
     <ol>
      <li>Let <var>starting point</var> be the <a data-link-type="dfn" href="editing.html#currently-focused-area-of-the-top-level-browsing-context" id="ref-for-currently-focused-area-of-the-top-level-browsing-context-21">currently focused area of a top-level
    browsing context</a>, if the user requested to move focus sequentially from there, or else the <a data-link-type="dfn" href="browsers.html#top-level-browsing-context" id="ref-for-top-level-browsing-context-15">top-level browsing context</a> itself, if the user instead requested to move focus from
    outside the <a data-link-type="dfn" href="browsers.html#top-level-browsing-context" id="ref-for-top-level-browsing-context-16">top-level browsing context</a>.
      </li><li>If there is a <a data-link-type="dfn" href="editing.html#sequential-focus-navigation-starting-point" id="ref-for-sequential-focus-navigation-starting-point-2">sequential focus navigation starting point</a> defined and it is
    inside <var>starting point</var>, then let <var>starting point</var> be the <a data-link-type="dfn" href="editing.html#sequential-focus-navigation-starting-point" id="ref-for-sequential-focus-navigation-starting-point-3">sequential
    focus navigation starting point</a> instead.
      </li><li>
       <p>Let <var>direction</var> be <i>forward</i> if the user requested the <em>next</em> control, and <i>backward</i> if the user requested the previous control.</p>
       <p class="note" role="note"> Typically, pressing <kbd>tab</kbd> requests the next control, and pressing <kbd><kbd>shift</kbd>+<kbd>tab</kbd></kbd> requests the previous control. </p>
      </li><li>
       <p><i>Loop</i>: Let <var>selection mechanism</var> be <i>sequential</i> if the <var>starting
    point</var> is a <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-84">browsing context</a> or if <var>starting point</var> is in its <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-36">control group</a>’s <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-14">sequential focus navigation order</a>.</p>
       <p>Otherwise, <var>starting point</var> is not in its <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-37">control group</a>’s <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-15">sequential focus navigation order</a>; let <var>selection mechanism</var> be <i>DOM</i>.</p>
      </li><li>Let <var>candidate</var> be the result of running the <a data-link-type="dfn" href="editing.html#sequential-navigation-search-algorithm" id="ref-for-sequential-navigation-search-algorithm-1">sequential navigation search
    algorithm</a> with <var>starting point</var>, <var>direction</var>, and <var>selection
    mechanism</var> as the arguments.
      </li><li>If <var>candidate</var> is not null, then run the <a data-link-type="dfn" href="editing.html#focusing-steps" id="ref-for-focusing-steps-11">focusing steps</a> for <var>candidate</var> and abort these steps.
      </li><li>Otherwise, unset the <a data-link-type="dfn" href="editing.html#sequential-focus-navigation-starting-point" id="ref-for-sequential-focus-navigation-starting-point-4">sequential focus navigation starting point</a>.
      </li><li>
       <p>If <var>starting point</var> is the <a data-link-type="dfn" href="browsers.html#top-level-browsing-context" id="ref-for-top-level-browsing-context-17">top-level browsing context</a>, or a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-68">focusable area</a> in the <a data-link-type="dfn" href="browsers.html#top-level-browsing-context" id="ref-for-top-level-browsing-context-18">top-level browsing context</a>, the user agent
    should transfer focus to its own controls appropriately (if any), honouring <var>direction</var>, and then abort these steps.</p>
       <p class="example" id="example-7611db4a"><a class="self-link" href="editing.html#example-7611db4a"></a> For example, if <var>direction</var> is <i>backward</i>, then the last
    focusable control before the browser’s rendering area would be the control to focus. </p>
       <p>If the user agent has no focusable controls — a kiosk-mode browser, for instance
    —
    then the user agent may instead restart these steps with the <var>starting point</var> being the <a data-link-type="dfn" href="browsers.html#top-level-browsing-context" id="ref-for-top-level-browsing-context-19">top-level browsing context</a> itself.</p>
      </li><li>Otherwise, <var>starting point</var> is a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-69">focusable area</a> in a <a data-link-type="dfn" href="browsers.html#nested-browsing-contexts" id="ref-for-nested-browsing-contexts-50">nested browsing context</a>. Let <var>starting point</var> be that <a data-link-type="dfn" href="browsers.html#nested-browsing-contexts" id="ref-for-nested-browsing-contexts-51">nested browsing context</a>’s <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-19">browsing context container</a>, and return to the
    step labeled <i>loop</i>. 
     </li></ol>
     <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="sequential-navigation-search-algorithm">sequential navigation search algorithm</dfn> consists of the following steps. This
  algorithm takes three arguments: <var>starting point</var>, <var>direction</var>,
  and <var>selection mechanism</var>.</p>
     <ol>
      <li>
       <p>Pick the appropriate cell from the following table, and follow the instructions in that cell.</p>
       <p>The appropriate cell is the one that is from the column whose header describes <var>direction</var> and from the first row whose header describes <var>starting point</var> and <var>selection mechanism</var>.</p>
       <table>
        <thead>
         <tr>
          <th>
          </th><th><var>direction</var> is <i>forward</i>
          </th><th><var>direction</var> is <i>backward</i>
        </th></tr></thead><tbody>
         <tr>
          <th><var>starting point</var> is a <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-85">browsing context</a>
          </th><td> Let <var>candidate</var> be the first <a data-link-type="dfn" href="editing.html#suitable-sequentially-focusable-area" id="ref-for-suitable-sequentially-focusable-area-1">suitable sequentially focusable area</a> in <var>starting point</var>’s <a data-link-type="dfn" href="browsers.html#active-document" id="ref-for-active-document-36">active document</a>’s <a data-link-type="dfn" href="editing.html#primary-control-group" id="ref-for-primary-control-group-1">primary control group</a>, if
            any; or else null 
          </td><td> Let <var>candidate</var> be the last <a data-link-type="dfn" href="editing.html#suitable-sequentially-focusable-area" id="ref-for-suitable-sequentially-focusable-area-2">suitable sequentially focusable area</a> in <var>starting point</var>’s <a data-link-type="dfn" href="browsers.html#active-document" id="ref-for-active-document-37">active document</a>’s <a data-link-type="dfn" href="editing.html#primary-control-group" id="ref-for-primary-control-group-2">primary control group</a>, if
            any; or else null 
         </td></tr><tr>
          <th><var>selection mechanism</var> is <i>DOM</i>
          </th><td> Let <var>candidate</var> be the first <a data-link-type="dfn" href="editing.html#suitable-sequentially-focusable-area" id="ref-for-suitable-sequentially-focusable-area-3">suitable sequentially focusable area</a> in the <a data-link-type="dfn" href="editing.html#home-control-group" id="ref-for-home-control-group-1">home control group</a> following <var>starting point</var>, if any; or else null 
          </td><td> Let <var>candidate</var> be the last <a data-link-type="dfn" href="editing.html#suitable-sequentially-focusable-area" id="ref-for-suitable-sequentially-focusable-area-4">suitable sequentially focusable area</a> in the <a data-link-type="dfn" href="editing.html#home-control-group" id="ref-for-home-control-group-2">home control group</a> preceding <var>starting point</var>, if any; or else null 
         </td></tr><tr>
          <th><var>selection mechanism</var> is <i>sequential</i>
          </th><td> Let <var>candidate</var> be the first <a data-link-type="dfn" href="editing.html#suitable-sequentially-focusable-area" id="ref-for-suitable-sequentially-focusable-area-5">suitable sequentially focusable area</a> in the <a data-link-type="dfn" href="editing.html#home-sequential-focus-navigation-order" id="ref-for-home-sequential-focus-navigation-order-1">home sequential focus navigation order</a> following <var>starting point</var>, if
            any; or else null 
          </td><td> Let <var>candidate</var> be the last <a data-link-type="dfn" href="editing.html#suitable-sequentially-focusable-area" id="ref-for-suitable-sequentially-focusable-area-6">suitable sequentially focusable area</a> in the <a data-link-type="dfn" href="editing.html#home-sequential-focus-navigation-order" id="ref-for-home-sequential-focus-navigation-order-2">home sequential focus navigation order</a> preceding <var>starting point</var>, if
            any; or else null 
       </td></tr></tbody></table>
       <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="suitable-sequentially-focusable-area">suitable sequentially focusable area</dfn> is a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-70">focusable area</a> whose <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-27">DOM
    anchor</a> is not <a data-link-type="dfn" href="editing.html#inertness" id="ref-for-inertness-41">inert</a> and that is in its <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-38">control group</a>’s <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-16">sequential
    focus navigation order</a>.</p>
       <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="primary-control-group">primary control group</dfn> of a <a data-link-type="dfn" href="editing.html#control-group-owner" id="ref-for-control-group-owner-24">control group owner object</a> <var>X</var> is the <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-39">control group</a> of <var>X</var> if <var>X</var> has no <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-27">dialog group</a> or if its <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-28">dialog group</a> has no
    designated <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-12">focused dialog of the dialog group</a>, otherwise, it is the <a data-link-type="dfn" href="editing.html#primary-control-group" id="ref-for-primary-control-group-3">primary
    control group</a> of <var>X</var>’s <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-29">dialog group</a>’s designated <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-13">focused dialog of the dialog group</a>.</p>
       <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="home-control-group">home control group</dfn> is the <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-40">control group</a> to which <var>starting point</var> belongs.</p>
       <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="home-sequential-focus-navigation-order">home sequential focus navigation order</dfn> is the <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-17">sequential focus
    navigation order</a> to which <var>starting point</var> belongs.</p>
       <p class="note" role="note"> The <a data-link-type="dfn" href="editing.html#home-sequential-focus-navigation-order" id="ref-for-home-sequential-focus-navigation-order-3">home sequential focus navigation order</a> is the <a data-link-type="dfn" href="editing.html#home-control-group" id="ref-for-home-control-group-3">home
    control group</a>’s <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-18">sequential focus navigation order</a>, but is only used when the <var>starting point</var> is in that <a data-link-type="dfn" href="editing.html#sequential-focus-navigation" id="ref-for-sequential-focus-navigation-19">sequential focus navigation order</a> (when it’s not, <var>selection mechanism</var> will be <i>DOM</i>). </p>
      </li><li>
       <p>If <var>candidate</var> is a <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-20">browsing context container</a>, then let <var>new candidate</var> be the result of running the <a data-link-type="dfn" href="editing.html#sequential-navigation-search-algorithm" id="ref-for-sequential-navigation-search-algorithm-2">sequential navigation search
    algorithm</a> with <var>candidate</var>’s <a data-link-type="dfn" href="browsers.html#nested-browsing-contexts" id="ref-for-nested-browsing-contexts-52">nested browsing context</a> as
    the first argument, <var>direction</var> as the second, and <i>sequential</i> as the third.</p>
       <p>If <var>new candidate</var> is null, then let <var>starting point</var> be <var>candidate</var>, and return to the top of this algorithm. Otherwise, let <var>candidate</var> be <var>new candidate</var>.</p>
      </li><li>Return <var>candidate</var>.
     </li></ol>
    </div>
    <h4 class="heading settled" data-level="5.4.6" id="focus-management-apis"><span class="secno">5.4.6. </span><span class="content">Focus management APIs</span><a class="self-link" href="editing.html#focus-management-apis"></a></h4>
    <dl class="domintro">
     <dt><var>document</var> . <code>activeElement</code>
     </dt><dd>
      <p>Returns the deepest element in the document through which or to which key events are being
    routed. This is, roughly speaking, the focused element in the document.</p>
      <p>For the purposes of this API, when a <a data-link-type="dfn" href="browsers.html#child-browsing-context" id="ref-for-child-browsing-context-7">child browsing context</a> is focused, its <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-21">browsing context container</a> is <a data-link-type="dfn" href="editing.html#focused" id="ref-for-focused-11">focused</a> in the <a data-link-type="dfn" href="browsers.html#parent-browsing-context" id="ref-for-parent-browsing-context-4">parent browsing context</a>. For example, if the user moves the focus to a text field
    in an <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-iframe" id="ref-for-elementdef-iframe-54">iframe</a></code>, the <code>iframe</code> is the element returned by the <code>activeElement</code> API in the <code>iframe</code>’s <a data-link-type="dfn" href="https://www.w3.org/TR/dom/#concept-node-document">node document</a>.</p>
     </dd><dt><var>document</var> . <code>hasFocus</code>()
     </dt><dd>
      <p>Returns true if key events are being routed through or to the document; otherwise, returns
    false. Roughly speaking, this corresponds to the document, or a document nested inside this
    one, being focused.</p>
     </dd><dt><var>window</var> . <code>focus</code>()
     </dt><dd>
      <p>Moves the focus to the window’s <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-86">browsing context</a>, if any.</p>
     </dd><dt><var>element</var> . <code>focus</code>()
     </dt><dd>
      <p>Moves the focus to the element.</p>
      <p>If the element is a <a data-link-type="dfn" href="browsers.html#browsing-context-container" id="ref-for-browsing-context-container-22">browsing context container</a>, moves the focus to the <a data-link-type="dfn" href="browsers.html#nested-browsing-contexts" id="ref-for-nested-browsing-contexts-53">nested browsing context</a> instead.</p>
     </dd><dt><var>element</var> . <code>blur</code>()
     </dt><dd>
      <p>Moves the focus to the <a data-link-type="dfn" href="infrastructure.html#viewport" id="ref-for-viewport-35">viewport</a>. Use of this method is discouraged; if you want to focus the <a data-link-type="dfn" href="infrastructure.html#viewport" id="ref-for-viewport-36">viewport</a>, call the <code>focus()</code> method on the <code>Document</code>’s root element.</p>
      <p>Do not use this method to hide the focus ring if you find the focus ring unsightly. Instead,
    use a CSS rule to override the <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css3-ui/#propdef-outline">outline</a> property, and provide a different way to show what
    element is focused. Be aware that if an alternative focusing style isn’t made available, the
    page will be significantly less usable for people who primarily navigate pages using a keyboard,
    or those with reduced vision who use focus outlines to help them navigate the page.</p>
      <div class="example" id="example-267407fd">
       <a class="self-link" href="editing.html#example-267407fd"></a> For example, to hide the outline from links and instead use a yellow background to indicate
      focus, you could use: 
<pre class="highlight"><span class="nt">:link:focus, :visited:focus </span><span class="p">{</span> <span class="k">outline</span><span class="p">:</span> none<span class="p">;</span> <span class="k">background</span><span class="p">:</span> yellow<span class="p">;</span> <span class="k">color</span><span class="p">:</span> black<span class="p">;</span> <span class="p">}</span>
</pre>
      </div>
      <p>Do not use this method to hide the focus ring. Do not use any
    other method that hides the focus ring from keyboard users, in
    particular do not use a CSS rule to override the <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css3-ui/#propdef-outline">outline</a> property. Removal of the focus ring leads to serious accessibility
    issues for users who navigate and interact with interactive
    content using the keyboard.</p>
    </dd></dl>
    <div class="impl">
     <p>The <dfn data-dfn-type="dfn" data-noexport="" id="activeelement"><code>activeElement</code><a class="self-link" href="editing.html#activeelement"></a></dfn> attribute on <code>Document</code> objects must return the value returned by the following steps:</p>
     <ol>
      <li>Let <var>candidate</var> be the <code>Document</code> on which the method was
    invoked.
      </li><li>If <var>candidate</var> has a <a data-link-type="dfn" href="editing.html#dialog-group" id="ref-for-dialog-group-30">dialog group</a> with a designated <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-14">focused dialog of the dialog group</a>, then let <var>candidate</var> be the
    designated <a data-link-type="dfn" href="editing.html#focused-dialog-of-the-dialog-group" id="ref-for-focused-dialog-of-the-dialog-group-15">focused dialog of the dialog group</a>, and redo this step.
      </li><li>If <var>candidate</var> has a non-empty <a data-link-type="dfn" href="editing.html#control-group" id="ref-for-control-group-41">control group</a>, let <var>candidate</var> be the designated <a data-link-type="dfn" href="editing.html#focused-area" id="ref-for-focused-area-20">focused area of the control
    group</a>. 
      </li><li>If <var>candidate</var> is a <a data-link-type="dfn" href="editing.html#focusable" id="ref-for-focusable-71">focusable area</a>, let <var>candidate</var> be <var>candidate</var>’s <a data-link-type="dfn" href="editing.html#dom-anchor" id="ref-for-dom-anchor-28">DOM anchor</a>.
      </li><li>
       <p>If <var>candidate</var> is a <code>Document</code> that has a <code><a data-link-type="element" href="sections.html#elementdef-body" id="ref-for-elementdef-body-56">body</a></code> element, then let <var>candidate</var> be <a href="sections.html#the-body-element">the <code>body</code> element</a> of that <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>.</p>
       <p>Otherwise, if <var>candidate</var> is a <code>Document</code> that has a <a data-link-type="dfn" href="infrastructure.html#root-element" id="ref-for-root-element-27">root
    element</a>, then let <var>candidate</var> be the <a data-link-type="dfn" href="infrastructure.html#root-element" id="ref-for-root-element-28">root element</a> of that <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>.</p>
       <p>Otherwise, if <var>candidate</var> is a <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>, then let <var>candidate</var> be null.</p>
      </li><li>Return <var>candidate</var>.
     </li></ol>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="Document" data-dfn-type="method" data-export="" id="dom-document-hasfocus"><code>hasFocus()</code></dfn> method on the <code>Document</code> object, when invoked, must return the result of running the <a data-link-type="dfn" href="editing.html#has-focus-steps" id="ref-for-has-focus-steps-1">has focus
  steps</a> with the <code>Document</code> object as the argument.</p>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="Window" data-dfn-type="method" data-export="" id="dom-window-focus"><code>focus()</code></dfn> method on the <code>Window</code> object, when invoked, must run the <a data-link-type="dfn" href="editing.html#focusing-steps" id="ref-for-focusing-steps-12">focusing steps</a> with the <code>Window</code> object’s <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-87">browsing context</a>. Additionally, if this <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-88">browsing context</a> is a <a data-link-type="dfn" href="browsers.html#top-level-browsing-context" id="ref-for-top-level-browsing-context-20">top-level browsing context</a>, user agents are encouraged to trigger some sort of
  notification to indicate to the user that the page is attempting to gain focus.</p>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="Window" data-dfn-type="method" data-export="" id="dom-window-blur"><code>blur()</code></dfn> method on the <code>Window</code> object, when invoked, provides a hint to the user agent that the script believes the user probably
  is not currently interested in the contents of the <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-89">browsing context</a> of the <code>Window</code> object on which the method was invoked, but that the contents might become
  interesting again in the future.</p>
     <p>User agents are encouraged to ignore calls to this <code>blur()</code> method entirely.</p>
     <p class="note" role="note"> Historically, the <code>focus()</code> and <code>blur()</code> methods actually affected the system-level focus of the
  system widget (e.g., tab or window) that contained the <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-90">browsing context</a>, but hostile
  sites widely abuse this behavior to the user’s detriment. </p>
     <p>The <code>focus()</code> method on elements, when invoked, must
  run the following algorithm:</p>
     <ol>
      <li>If the element is marked as <i>locked for focus</i>, then abort these steps.
      </li><li>Mark the element as <dfn data-dfn-type="dfn" data-noexport="" id="locked-for-focus">locked for focus<a class="self-link" href="editing.html#locked-for-focus"></a></dfn>.
      </li><li>Run the <a data-link-type="dfn" href="editing.html#focusing-steps" id="ref-for-focusing-steps-13">focusing steps</a> for the element.
      </li><li>Unmark the element as <i>locked for focus</i>.
     </li></ol>
     <p>The <code>blur()</code> method, when invoked, should run the <a data-link-type="dfn" href="editing.html#unfocusing-steps" id="ref-for-unfocusing-steps-3">unfocusing steps</a> for the element on which the method was called. User agents may
  selectively or uniformly ignore calls to this method for usability reasons.</p>
     <p class="example" id="example-14514a00"><a class="self-link" href="editing.html#example-14514a00"></a> For example, if the <code>blur()</code> method is unwisely
  being used to remove the focus ring for aesthetics reasons, the page would become unusable by
  keyboard users. Ignoring calls to this method would thus allow keyboard users to interact with the
  page. </p>
    </div>
    <h3 class="heading settled" data-level="5.5" id="assigning-keyboard-shortcuts"><span class="secno">5.5. </span><span class="content">Assigning keyboard shortcuts</span><a class="self-link" href="editing.html#assigning-keyboard-shortcuts"></a></h3>
    <h4 class="heading settled" data-level="5.5.1" id="assigning-keyboard-shortcuts-introduction"><span class="secno">5.5.1. </span><span class="content">Introduction</span><a class="self-link" href="editing.html#assigning-keyboard-shortcuts-introduction"></a></h4>
    <p><em>This section is non-normative.</em></p>
    <p>Each element that can be activated or focused can be assigned a shortcut key combination to
  activate it, using the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-accesskey" id="ref-for-element-attrdef-global-accesskey-2">accesskey</a></code> attribute.</p>
    <p>The exact shortcut is determined by the user agent, potentially using information about the user’s
  preferences, what keyboard shortcuts already exist on the platform, and what other shortcuts have
  been specified on the page, as well as the value of the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-accesskey" id="ref-for-element-attrdef-global-accesskey-3">accesskey</a></code> attribute.</p>
    <p>A valid value for <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-accesskey" id="ref-for-element-attrdef-global-accesskey-4">accesskey</a></code> consists of a single character, such as a letter or digit.</p>
    <p>User agents can provide users with a list of the keyboard shortcuts, but authors are encouraged
  to do so also.</p>
    <div class="example" id="example-2cea7f77">
     <a class="self-link" href="editing.html#example-2cea7f77"></a> In this example, an author has provided a button that can be invoked using a shortcut key,
    and suggested "C" as a memorable and useful shortcut. 
<pre class="highlight"><span class="nt">&lt;input</span> <span class="na">type=</span><span class="s">button</span> <span class="na">value=</span><span class="s">Collect</span> <span class="na">onclick=</span><span class="s">"collect()"</span> <span class="na">accesskey=</span><span class="s">"C"</span> <span class="na">id=</span><span class="s">c</span><span class="nt">&gt;</span>
</pre>
    </div>
    <h4 class="heading settled" data-level="5.5.2" id="the-accesskey-attribute"><span class="secno">5.5.2. </span><span class="content">The <code>accesskey</code> attribute</span><a class="self-link" href="editing.html#the-accesskey-attribute"></a></h4>
    <p>All <a data-link-type="dfn" href="infrastructure.html#html-element" id="ref-for-html-element-56">html elements</a> may have the <dfn class="dfn-paneled" data-dfn-for="global" data-dfn-type="element-attr" data-export="" id="element-attrdef-global-accesskey"><code>accesskey</code></dfn> content attribute set. The <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-accesskey" id="ref-for-element-attrdef-global-accesskey-5">accesskey</a></code> attribute’s value is used
  by the user agent as a guide for creating a keyboard shortcut that activates or focuses the
  element.</p>
    <p>If specified, the value must be a single printable character: a string exactly one Unicode code point in length.</p>
    <p>Authors should not use <samp>" "</samp>, nor characters that normally require a modifier key to
  generate, as a value of <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-accesskey" id="ref-for-element-attrdef-global-accesskey-6">accesskey</a></code>.</p>
    <div class="example" id="example-2d8e7edd">
     <a class="self-link" href="editing.html#example-2d8e7edd"></a> In the following example, a variety of links are given with access keys so that keyboard users
    familiar with the site can more quickly navigate to the relevant pages: 
<pre class="highlight"><span class="nt">&lt;nav&gt;</span>
  <span class="nt">&lt;p&gt;</span>
    <span class="nt">&lt;a</span> <span class="na">title=</span><span class="s">"Consortium Activities"</span> <span class="na">accesskey=</span><span class="s">"A"</span> <span class="na">href=</span><span class="s">"/Consortium/activities"</span><span class="nt">&gt;</span>Activities<span class="nt">&lt;/a&gt;</span> |
    <span class="nt">&lt;a</span> <span class="na">title=</span><span class="s">"Technical Reports and Recommendations"</span> <span class="na">accesskey=</span><span class="s">"T"</span> <span class="na">href=</span><span class="s">"/TR/"</span><span class="nt">&gt;</span>Technical Reports<span class="nt">&lt;/a&gt;</span> |
    <span class="nt">&lt;a</span> <span class="na">title=</span><span class="s">"Alphabetical Site Index"</span> <span class="na">accesskey=</span><span class="s">"S"</span> <span class="na">href=</span><span class="s">"/Consortium/siteindex"</span><span class="nt">&gt;</span>Site Index<span class="nt">&lt;/a&gt;</span> |
    <span class="nt">&lt;a</span> <span class="na">title=</span><span class="s">"About This Site"</span> <span class="na">accesskey=</span><span class="s">"B"</span> <span class="na">href=</span><span class="s">"/Consortium/"</span><span class="nt">&gt;</span>About Consortium<span class="nt">&lt;/a&gt;</span> |
    <span class="nt">&lt;a</span> <span class="na">title=</span><span class="s">"Contact Consortium"</span> <span class="na">accesskey=</span><span class="s">"C"</span> <span class="na">href=</span><span class="s">"/Consortium/contact"</span><span class="nt">&gt;</span>Contact<span class="nt">&lt;/a&gt;</span>
  <span class="nt">&lt;/p&gt;</span>
<span class="nt">&lt;/nav&gt;</span>
</pre>
    </div>
    <div class="impl">
     <h4 class="heading settled" data-level="5.5.3" id="assigning-keyboard-shortcuts-processing-model"><span class="secno">5.5.3. </span><span class="content">Processing model</span><a class="self-link" href="editing.html#assigning-keyboard-shortcuts-processing-model"></a></h4>
     <p>An element’s <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="assigned-access-key">assigned access key</dfn> is a key combination derived from the element’s <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-accesskey" id="ref-for-element-attrdef-global-accesskey-7">accesskey</a></code> content attribute, or assigned by the user agent, optionally
  based on a user preference. Initially, an element must not have an <a data-link-type="dfn" href="editing.html#assigned-access-key" id="ref-for-assigned-access-key-11">assigned access key</a>.</p>
     <p>Whenever an element’s <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-accesskey" id="ref-for-element-attrdef-global-accesskey-8">accesskey</a></code> attribute is set, changed,
  or removed, the user agent must update the element’s <a data-link-type="dfn" href="editing.html#assigned-access-key" id="ref-for-assigned-access-key-12">assigned access key</a> by running
  the following steps:</p>
     <ol>
      <li>If the element has no <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-accesskey" id="ref-for-element-attrdef-global-accesskey-9">accesskey</a></code> attribute, then skip
    to the <i>fallback</i> step below.
      </li><li>The user agent may assign a key combination based on stored user preferences as the
    element’s <a data-link-type="dfn" href="editing.html#assigned-access-key" id="ref-for-assigned-access-key-13">assigned access key</a> and then abort these steps.
      </li><li>Let <var>value</var> be the value of the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-accesskey" id="ref-for-element-attrdef-global-accesskey-10">accesskey</a></code> attribute. 
      </li><li>The user agent may strip content from <var>value</var> to reduce the length of <var>value</var> to a single unicode code point.
      </li><li>If <var>value</var> is not a string exactly one Unicode code point in length, then
    abort these steps.
      </li><li>The user agent may assign a combination of a mix of zero or more modifier keys and <var>value</var> as the element’s <a data-link-type="dfn" href="editing.html#assigned-access-key" id="ref-for-assigned-access-key-14">assigned access key</a> and abort these steps.
      </li><li><i>Fallback</i>: Optionally, the user agent may assign a key combination of its choosing
    as the element’s <a data-link-type="dfn" href="editing.html#assigned-access-key" id="ref-for-assigned-access-key-15">assigned access key</a> and then abort these steps.
      </li><li>If this step is reached, the element has no <a data-link-type="dfn" href="editing.html#assigned-access-key" id="ref-for-assigned-access-key-16">assigned access key</a>.
     </li></ol>
     <p>Once a user agent has selected and assigned an access key for an element, the user agent should
  not change the element’s <a data-link-type="dfn" href="editing.html#assigned-access-key" id="ref-for-assigned-access-key-17">assigned access key</a> unless the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-accesskey" id="ref-for-element-attrdef-global-accesskey-11">accesskey</a></code> content
  attribute is changed or the element is moved to another <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>.</p>
     <p>When the user presses the key combination corresponding to the <a data-link-type="dfn" href="editing.html#assigned-access-key" id="ref-for-assigned-access-key-18">assigned access key</a> for an element, if the element defines a command, the
  command’s <a data-link-type="facet" href="interactive-elements.html#facetdef-menuitem-hidden-state" id="ref-for-facetdef-menuitem-hidden-state-10">Hidden State</a> facet is false (visible),
  the command’s <a data-link-type="facet" href="interactive-elements.html#facetdef-menuitem-disabled-state" id="ref-for-facetdef-menuitem-disabled-state-12">Disabled State</a> facet is also false
  (enabled), the element is <a data-link-type="dfn" href="infrastructure.html#in-the-document" id="ref-for-in-the-document-23">in a <code>Document</code></a> that has an associated <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-91">browsing context</a>, and neither the element nor any of its ancestors has a <code>hidden</code> attribute specified, then the user agent must trigger the <a data-link-type="dfn" href="sec-forms.html#action" id="ref-for-action-5">Action</a> of the command.</p>
     <p class="note" role="note"> User agents might expose elements that have
  an <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-accesskey" id="ref-for-element-attrdef-global-accesskey-12">accesskey</a></code> attribute in other ways as well, e.g., in a menu
  displayed in response to a specific key combination. </p>
     <hr>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="HTMLElement" data-dfn-type="attribute" data-export="" id="dom-htmlelement-accesskey"><code>accessKey</code></dfn> IDL attribute must <a data-link-type="dfn" href="infrastructure.html#reflection" id="ref-for-reflection-118">reflect</a> the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-accesskey" id="ref-for-element-attrdef-global-accesskey-13">accesskey</a></code> content attribute.</p>
    </div>
    <h3 class="heading settled" data-level="5.6" id="user-interaction-editing"><span class="secno">5.6. </span><span class="content">Editing</span><a class="self-link" href="editing.html#user-interaction-editing"></a></h3>
    <h4 class="heading settled" data-level="5.6.1" id="making-document-regions-editable-the-contenteditable-content-attribute"><span class="secno">5.6.1. </span><span class="content">Making document regions editable: The <code>contenteditable</code> content attribute</span><a class="self-link" href="editing.html#making-document-regions-editable-the-contenteditable-content-attribute"></a></h4>
<pre class="idl highlight def" data-highlight="webidl">[<a class="nv idl-code" data-link-type="extended-attribute">NoInterfaceObject</a>]
<span class="kt">interface</span> <dfn class="nv dfn-paneled idl-code" data-dfn-for="ElementContentEditable" data-dfn-type="interface" data-export="" id="elementcontenteditable-elementcontenteditable">ElementContentEditable</dfn> {
  <span class="kt">attribute</span> <span class="kt">DOMString</span> <a class="nv idl-code" data-link-type="attribute" data-type="DOMString" href="editing.html#dom-elementcontenteditable-contenteditable" id="ref-for-dom-elementcontenteditable-contenteditable-1">contentEditable</a>;
  <span class="kt">readonly</span> <span class="kt">attribute</span> <span class="kt">boolean</span> <a class="nv idl-code" data-link-type="attribute" data-readonly="" data-type="boolean" href="editing.html#dom-elementcontenteditable-iscontenteditable" id="ref-for-dom-elementcontenteditable-iscontenteditable-1">isContentEditable</a>;
};
</pre>
    <p>The <dfn class="dfn-paneled" data-dfn-for="global" data-dfn-type="element-attr" data-export="" id="element-attrdef-global-contenteditable"><code>contenteditable</code></dfn> content attribute is an <a data-link-type="dfn" href="infrastructure.html#enumerated-attributes" id="ref-for-enumerated-attributes-21">enumerated attribute</a> whose keywords are the empty string, <code>true</code>,
  and <code>false</code>. The empty string and the <code>true</code> keyword map
  to the <i>true</i> state. The <code>false</code> keyword maps to the <i>false</i> state.
  In addition, there is a third state, the <i>inherit</i> state, which is the <i>missing value default</i> (and the <i>invalid value default</i>).</p>
    <p>The <i>true</i> state indicates that the element is editable. The <i>inherit</i> state
  indicates that the element is editable if its parent is. The <i>false</i> state indicates that the
  element is not editable.</p>
    <dl class="domintro">
     <dt><var>element</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-elementcontenteditable-contenteditable" id="ref-for-dom-elementcontenteditable-contenteditable-2">contentEditable</a></code> [ = <var>value</var> ]
     </dt><dd>
      <p>Returns "<code>true</code>", "<code>false</code>", or "<code>inherit</code>", based on the state of the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-contenteditable" id="ref-for-element-attrdef-global-contenteditable-2">contenteditable</a></code> attribute.</p>
      <p>Can be set, to change that state.</p>
      <p>Throws a "<code class="idl"><a data-link-type="idl" href="http://www.ecma-international.org/ecma-262/6.0/#sec-native-error-types-used-in-this-standard-syntaxerror">SyntaxError</a></code>" <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/WebIDL-1/#idl-DOMException">DOMException</a></code> if the new value isn’t one of those strings.</p>
     </dd><dt><var>element</var> . <code>isContentEditable</code>
     </dt><dd>
      <p>Returns true if the element is editable; otherwise, returns false.</p>
    </dd></dl>
    <div class="impl">
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="ElementContentEditable" data-dfn-type="attribute" data-export="" id="dom-elementcontenteditable-contenteditable"><code>contentEditable</code></dfn> IDL attribute, on
  getting, must return the string "<code>true</code>" if the content attribute is set to
  the true state, "<code>false</code>" if the content attribute is set to the false state,
  and "<code>inherit</code>" otherwise. On setting, if the new value is an <a data-link-type="dfn" href="infrastructure.html#ascii-case-insensitive" id="ref-for-ascii-case-insensitive-45">ASCII
  case-insensitive</a> match for the string "<code>inherit</code>" then the content
  attribute must be removed, if the new value is an <a data-link-type="dfn" href="infrastructure.html#ascii-case-insensitive" id="ref-for-ascii-case-insensitive-46">ASCII case-insensitive</a> match for
  the string "<code>true</code>" then the content attribute must be set to the string
  "<code>true</code>", if the new value is an <a data-link-type="dfn" href="infrastructure.html#ascii-case-insensitive" id="ref-for-ascii-case-insensitive-47">ASCII case-insensitive</a> match for
  the string "<code>false</code>" then the content attribute must be set to the string
  "<code>false</code>", and otherwise the attribute setter must throw a
  "<code class="idl"><a data-link-type="idl" href="http://www.ecma-international.org/ecma-262/6.0/#sec-native-error-types-used-in-this-standard-syntaxerror">SyntaxError</a></code>" <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/WebIDL-1/#idl-DOMException">DOMException</a></code>.</p>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="ElementContentEditable" data-dfn-type="attribute" data-export="" id="dom-elementcontenteditable-iscontenteditable"><code>isContentEditable</code></dfn> IDL attribute, on
  getting, must return true if the element is either an <a data-link-type="dfn" href="editing.html#editing-host" id="ref-for-editing-host-3">editing host</a> or <a data-link-type="dfn" href="editing.html#editable" id="ref-for-editable-2">editable</a>, and false otherwise.</p>
    </div>
    <h4 class="heading settled" data-level="5.6.2" id="making-entire-documents-editable-the-designmode-idl-attribute"><span class="secno">5.6.2. </span><span class="content">Making entire documents editable: The <code>designMode</code> IDL attribute</span><a class="self-link" href="editing.html#making-entire-documents-editable-the-designmode-idl-attribute"></a></h4>
    <div class="impl">
     <p>Documents have a <dfn data-dfn-type="dfn" data-noexport="" id="designmode"><code>designMode</code><a class="self-link" href="editing.html#designmode"></a></dfn>, which can be either enabled or
  disabled.</p>
    </div>
    <dl class="domintro">
     <dt><var>document</var> . <code>designMode</code> [ = <var>value</var> ]
     </dt><dd>
      <p>Returns "<code>on</code>" if the document is editable, and "<code>off</code>" if it isn’t.</p>
      <p>Can be set, to change the document’s current state. This focuses the document and resets the
    selection in that document.</p>
    </dd></dl>
    <div class="impl">
     <p>The <code>designMode</code> IDL attribute on the <code>Document</code> object takes two values, "<code>on</code>" and "<code>off</code>". On setting, the new value must be compared in an <a data-link-type="dfn" href="infrastructure.html#ascii-case-insensitive" id="ref-for-ascii-case-insensitive-48">ASCII
  case-insensitive</a> manner to these two values; if it matches the "<code>on</code>"
  value, then <code>designMode</code> must be enabled, and if it
  matches the "<code>off</code>" value, then <code>designMode</code> must be disabled. Other values must be
  ignored.</p>
     <p>On getting, if <code>designMode</code> is enabled, the IDL
  attribute must return the value "<code>on</code>"; otherwise it is disabled, and the
  attribute must return the value "<code>off</code>".</p>
     <p>The last state set must persist until the document is destroyed or the state is changed.
  Initially, documents must have their <code>designMode</code> disabled.</p>
     <p>When the <code>designMode</code> changes from being disabled to
  being enabled, the user agent must <a data-link-type="dfn" href="infrastructure.html#immediately" id="ref-for-immediately-12">immediately</a> reset the document’s <a data-link-type="dfn" href="editing.html#active-range" id="ref-for-active-range-1">active range</a>’s
  start and end boundary points to be at the start of the <code>Document</code> and then run the <a data-link-type="dfn" href="editing.html#focusing-steps" id="ref-for-focusing-steps-14">focusing steps</a> for the root element of the <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>, if any.</p>
    </div>
    <h4 class="heading settled" data-level="5.6.3" id="best-practices-for-in-page-editors"><span class="secno">5.6.3. </span><span class="content">Best practices for in-page editors</span><a class="self-link" href="editing.html#best-practices-for-in-page-editors"></a></h4>
    <p>Authors are encouraged to set the <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css-text-3/#white-space">white-space</a> property on <a data-link-type="dfn" href="editing.html#editing-host" id="ref-for-editing-host-4">editing
  hosts</a> and on markup that was originally created through these editing mechanisms to the
  value <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">pre-wrap</a>. Default HTML whitespace handling is not well suited to WYSIWYG editing, and line
  wrapping will not work correctly in some corner cases if <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css-text-3/#white-space">white-space</a> is left at its default
  value.</p>
    <div class="example" id="example-9da9a343">
     <a class="self-link" href="editing.html#example-9da9a343"></a> As an example of problems that occur if the default <span class="css">normal</span> value is used instead, consider
    the case of the user typing "<kbd>yellow␣␣ball</kbd>", with two spaces (here
    represented by "␣") between the words. With the editing rules in place for the default
    value of <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css-text-3/#white-space">white-space</a> (<span class="css">normal</span>), the resulting markup will either consist of
    "<samp>yellow&amp;nbsp;&nbsp;ball</samp>" or "<samp>yellow&nbsp;&amp;nbsp;ball</samp>"; i.e.,
    there will be a non-breaking space between the two words in addition to the regular space. This
    is necessary because the <span class="css">normal</span> value for <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css-text-3/#white-space">white-space</a> requires adjacent regular spaces to be
    collapsed together. 
     <p>In the former case, "<samp>yellow⍽</samp>" might wrap to the next line ("⍽"
    being used here to represent a non-breaking space) even though "<samp>yellow</samp>" alone might
    fit at the end of the line; in the latter case, "<samp>⍽ball</samp>", if wrapped to the
    start of the line, would have visible indentation from the non-breaking space.</p>
     <p>When <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css-text-3/#white-space">white-space</a> is set to <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">pre-wrap</a>, however, the editing rules will instead simply put
    two regular spaces between the words, and should the two words be split at the end of a line, the
    spaces would be neatly removed from the rendering.</p>
    </div>
    <h4 class="heading settled" data-level="5.6.4" id="editing-apis"><span class="secno">5.6.4. </span><span class="content">Editing APIs</span><a class="self-link" href="editing.html#editing-apis"></a></h4>
    <p>The definition of the terms <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="active-range">active range</dfn>, <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="editing-host">editing host</dfn>, and <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="editable">editable</dfn>, the user interface requirements of elements that are <a data-link-type="dfn" href="editing.html#editing-host" id="ref-for-editing-host-5">editing hosts</a> or <a data-link-type="dfn" href="editing.html#editable" id="ref-for-editable-3">editable</a>, the <dfn class="css" data-dfn-type="function" data-export="" id="funcdef-execcommand"><code>execCommand()</code><a class="self-link" href="editing.html#funcdef-execcommand"></a></dfn>, <dfn class="css" data-dfn-type="function" data-export="" id="funcdef-querycommandenabled"><code>queryCommandEnabled()</code><a class="self-link" href="editing.html#funcdef-querycommandenabled"></a></dfn>, <dfn class="css" data-dfn-type="function" data-export="" id="funcdef-querycommandindeterm"><code>queryCommandIndeterm()</code><a class="self-link" href="editing.html#funcdef-querycommandindeterm"></a></dfn>, <dfn class="css" data-dfn-type="function" data-export="" id="funcdef-querycommandstate"><code>queryCommandState()</code><a class="self-link" href="editing.html#funcdef-querycommandstate"></a></dfn>, <dfn class="css" data-dfn-type="function" data-export="" id="funcdef-querycommandsupported"><code>queryCommandSupported()</code><a class="self-link" href="editing.html#funcdef-querycommandsupported"></a></dfn>, and <dfn class="css" data-dfn-type="function" data-export="" id="funcdef-querycommandvalue"><code>queryCommandValue()</code><a class="self-link" href="editing.html#funcdef-querycommandvalue"></a></dfn> methods, text selections, and the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="delete-the-selection">delete the selection</dfn> algorithm are being specified in the various developing
  HTML Editing specification drafts <a data-link-type="biblio" href="references.html#biblio-editing">[EDITING]</a>. The interaction of editing and undo/redo
  features are being specified in the UndoManager and DOM Transaction specification. <a data-link-type="biblio" href="references.html#biblio-undo">[UNDO]</a></p>
    <h4 class="heading settled" data-level="5.6.5" id="spelling-and-grammar-checking"><span class="secno">5.6.5. </span><span class="content">Spelling and grammar checking</span><a class="self-link" href="editing.html#spelling-and-grammar-checking"></a></h4>
    <div class="impl">
     <p>User agents can support the checking of spelling and grammar of editable text, either in form
  controls (such as the value of <code><a data-link-type="element" href="sec-forms.html#elementdef-textarea" id="ref-for-elementdef-textarea-77">textarea</a></code> elements), or in elements in an <a data-link-type="dfn" href="editing.html#editing-host" id="ref-for-editing-host-6">editing
  host</a> (e.g., using <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-contenteditable" id="ref-for-element-attrdef-global-contenteditable-3">contenteditable</a></code>).</p>
     <p>For each element, user agents must establish a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="default-behavior">default behavior</dfn>, either through
  defaults or through preferences expressed by the user. There are
  three possible default behaviors for each element:</p>
     <dl>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="true-by-default">true-by-default</dfn> 
      </dt><dd>The element will be checked for spelling and grammar if its contents are editable and
    spellchecking is not explicitly disabled through the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-spellcheck" id="ref-for-element-attrdef-global-spellcheck-1">spellcheck</a></code> attribute. 
      </dd><dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="false-by-default">false-by-default</dfn> 
      </dt><dd>The element will never be checked for spelling and grammar unless spellchecking is
    explicitly enabled through the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-spellcheck" id="ref-for-element-attrdef-global-spellcheck-2">spellcheck</a></code> attribute. 
      </dd><dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="inherit-by-default">inherit-by-default</dfn> 
      </dt><dd>The element’s default behavior is the same as its parent element’s. Elements that have no
    parent element cannot have this as their default behavior. 
     </dd></dl>
     <hr>
    </div>
    <p>The <dfn class="dfn-paneled" data-dfn-for="global" data-dfn-type="element-attr" data-export="" id="element-attrdef-global-spellcheck"><code>spellcheck</code></dfn> attribute is an <a data-link-type="dfn" href="infrastructure.html#enumerated-attributes" id="ref-for-enumerated-attributes-22">enumerated
  attribute</a> whose keywords are the empty string, <code>true</code> and <code>false</code>. The empty string and the <code>true</code> keyword map to the <i>true</i> state. The <code>false</code> keyword maps to the <i>false</i> state. In
  addition, there is a third state, the <i>default</i> state, which is the <i>missing value default</i> (and the <i>invalid value default</i>).</p>
    <p class="note" role="note"> The <i>true</i> state indicates that the element is to have its spelling and
  grammar checked. The <i>default</i> state indicates that the element is to act according to a
  default behavior, possibly based on the parent element’s own <code>spellcheck</code> state, as defined below. The <i>false</i> state
  indicates that the element is not to be checked. </p>
    <div class="impl">
     <hr>
    </div>
    <dl class="domintro">
     <dt><var>element</var> . <code>spellcheck</code> [ = <var>value</var> ]
     </dt><dd>
      <p>Returns true if the element is to have its spelling and grammar checked; otherwise, returns
    false.</p>
      <p>Can be set, to override the default and set the <code>spellcheck</code> content attribute.</p>
     </dd><dt><var>element</var> . <code>forceSpellCheck</code>()
     </dt><dd>
      <p>Forces the user agent to report spelling and grammar errors on the element (if checking is
    enabled), even if the user has never focused the element. (If the method is not invoked, user
    agents can hide errors in text that wasn’t just entered by the user.)</p>
    </dd></dl>
    <div class="impl">
     <p>The <code class="idl"><a data-link-type="idl" href="dom.html#dom-htmlelement-spellcheck" id="ref-for-dom-htmlelement-spellcheck-1">spellcheck</a></code> IDL attribute, on getting, must
  return true if the element’s <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-spellcheck" id="ref-for-element-attrdef-global-spellcheck-3">spellcheck</a></code> content attribute is
  in the <i>true</i> state, or if the element’s <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-spellcheck" id="ref-for-element-attrdef-global-spellcheck-4">spellcheck</a></code> content attribute is in the <i>default</i> state and the element’s <a data-link-type="dfn" href="editing.html#default-behavior" id="ref-for-default-behavior-1">default behavior</a> is <a data-link-type="dfn" href="editing.html#true-by-default" id="ref-for-true-by-default-1">true-by-default</a>, or if the element’s <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-spellcheck" id="ref-for-element-attrdef-global-spellcheck-5">spellcheck</a></code> content attribute is in the <i>default</i> state and the
  element’s <a data-link-type="dfn" href="editing.html#default-behavior" id="ref-for-default-behavior-2">default behavior</a> is <a data-link-type="dfn" href="editing.html#inherit-by-default" id="ref-for-inherit-by-default-1">inherit-by-default</a> and the element’s parent
  element’s <code class="idl"><a data-link-type="idl" href="dom.html#dom-htmlelement-spellcheck" id="ref-for-dom-htmlelement-spellcheck-2">spellcheck</a></code> IDL attribute would return true;
  otherwise, if none of those conditions applies, then the attribute must instead return false.</p>
     <p class="note" role="note"> The <code class="idl"><a data-link-type="idl" href="dom.html#dom-htmlelement-spellcheck" id="ref-for-dom-htmlelement-spellcheck-3">spellcheck</a></code> IDL attribute is not affected
  by user preferences that override the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-spellcheck" id="ref-for-element-attrdef-global-spellcheck-6">spellcheck</a></code> content
  attribute, and therefore might not reflect the actual spellchecking state. </p>
     <p>On setting, if the new value is true, then the element’s <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-spellcheck" id="ref-for-element-attrdef-global-spellcheck-7">spellcheck</a></code> content attribute must be set to the literal string
  "<code>true</code>", otherwise it must be set to the literal string "<code>false</code>".</p>
     <hr>
     <p>User agents must only consider the following pieces of text as checkable for the purposes of
  this feature:</p>
     <ul>
      <li>The <a data-link-type="dfn" href="sec-forms.html#forms-value" id="ref-for-forms-value-243">value</a> of <code><a data-link-type="element" href="sec-forms.html#elementdef-input" id="ref-for-elementdef-input-285">input</a></code> elements whose <code><a data-link-type="element-sub" href="sec-forms.html#element-attrdef-input-type" id="ref-for-element-attrdef-input-type-140">type</a></code> attributes are in the <a data-link-type="element-state" href="sec-forms.html#element-statedef-input-text" id="ref-for-element-statedef-input-text-54">Text</a>, <a data-link-type="element-state" href="sec-forms.html#element-statedef-input-search" id="ref-for-element-statedef-input-search-17">Search</a>, <a data-link-type="element-state" href="sec-forms.html#element-statedef-input-url" id="ref-for-element-statedef-input-url-12">URL</a>, or <a data-link-type="element-state" href="sec-forms.html#element-statedef-input-e-mail" id="ref-for-element-statedef-input-e-mail-14">E-mail</a> states and that are <i>mutable</i> (i.e., that do not have the <code>readonly</code> attribute specified and that are not disabled).
      </li><li>The <a data-link-type="dfn" href="sec-forms.html#forms-value" id="ref-for-forms-value-244">value</a> of <code><a data-link-type="element" href="sec-forms.html#elementdef-textarea" id="ref-for-elementdef-textarea-78">textarea</a></code> elements that do not
    have a <code>readonly</code> attribute and that are not disabled.
      </li><li>Text in <code>Text</code> nodes that are children of <a data-link-type="dfn" href="editing.html#editing-host" id="ref-for-editing-host-7">editing
    hosts</a> or <a data-link-type="dfn" href="editing.html#editable" id="ref-for-editable-4">editable</a> elements.
      </li><li>Text in attributes of <a data-link-type="dfn" href="editing.html#editable" id="ref-for-editable-5">editable</a> elements.
     </li></ul>
     <p>For text that is part of a <code>Text</code> node, the element with which the text is
  associated is the element that is the immediate parent of the first character of the word,
  sentence, or other piece of text. For text in attributes, it is the attribute’s element. For the
  values of <code>input</code> and <code><a data-link-type="element" href="sec-forms.html#elementdef-textarea" id="ref-for-elementdef-textarea-79">textarea</a></code> elements, it is the element itself.</p>
     <p>To determine if a word, sentence, or other piece of text in an applicable element (as defined
  above) is to have spelling- and grammar-checking enabled, the user agent must use the following
  algorithm:</p>
     <ol>
      <li>If the user has disabled the checking for this text, then the checking is disabled.
      </li><li>Otherwise, if the user has forced the checking for this text to always be enabled, then the
    checking is enabled.
      </li><li>Otherwise, if the element with which the text is associated has a <code>spellcheck</code> content attribute, then: if that attribute is in the <i>true</i> state, then checking is enabled; otherwise, if that attribute is in the <i>false</i> state, then checking is disabled.
      </li><li>Otherwise, if there is an ancestor element with a <code>spellcheck</code> content attribute that is not in the <i>default</i> state, then: if the nearest such ancestor’s <code>spellcheck</code> content attribute is in the <i>true</i> state, then checking is enabled; otherwise, checking is
    disabled.
      </li><li>Otherwise, if the element’s <a data-link-type="dfn" href="editing.html#default-behavior" id="ref-for-default-behavior-3">default behavior</a> is <a data-link-type="dfn" href="editing.html#true-by-default" id="ref-for-true-by-default-2">true-by-default</a>, then checking is
    enabled.
      </li><li>Otherwise, if the element’s <a data-link-type="dfn" href="editing.html#default-behavior" id="ref-for-default-behavior-4">default behavior</a> is <a data-link-type="dfn" href="editing.html#false-by-default" id="ref-for-false-by-default-1">false-by-default</a>, then checking is
    disabled.
      </li><li>Otherwise, if the element’s parent element has <em>its</em> checking enabled, then checking
    is enabled.
      </li><li>Otherwise, checking is disabled.
     </li></ol>
     <p>If the checking is enabled for a word/sentence/text, the user agent should indicate spelling
  and grammar errors in that text. User agents should take into account the other semantics given in
  the document when suggesting spelling and grammar corrections. User agents may use the language of
  the element to determine what spelling and grammar rules to use, or may use the user’s preferred
  language settings. user agents should use <code><a data-link-type="element" href="sec-forms.html#elementdef-input" id="ref-for-elementdef-input-286">input</a></code> element attributes such as <code>pattern</code> to ensure that the resulting value is valid, where
  possible.</p>
     <p>If checking is disabled, the user agent should not indicate spelling or grammar errors for that
  text.</p>
     <p>Even when checking is enabled, user agents may opt to not report spelling or grammar errors in
  text that the user agent deems the user has no interest in having checked (e.g., text that was
  already present when the page was loaded, or that the user did not type, or text in controls that
  the user has not focused, or in parts of e-mail addresses that the user agent is not confident
  were misspelt). The <dfn class="css" data-dfn-type="function" data-export="" id="funcdef-forcespellcheck"><code>forceSpellCheck()</code><a class="self-link" href="editing.html#funcdef-forcespellcheck"></a></dfn> method,
  when invoked on an element, must override this behavior, forcing the user agent to consider all
  spelling and grammar errors in text in that element for which checking is enabled to be of
  interest to the user.</p>
     <div class="example" id="example-abc6df72">
      <a class="self-link" href="editing.html#example-abc6df72"></a> The element with ID "a" in the following example would be the one used to determine if the
    word "Hello" is checked for spelling errors. In this example, it would not be. 
<pre class="highlight"><span class="nt">&lt;div</span> <span class="na">contenteditable=</span><span class="s">"true"</span><span class="nt">&gt;</span>
<span class="nt">&lt;span</span> <span class="na">spellcheck=</span><span class="s">"false"</span><span class="nt">&gt;</span>Hell<span class="nt">&lt;/span&gt;&lt;em&gt;</span>o!<span class="nt">&lt;/em&gt;</span>
<span class="nt">&lt;/div&gt;</span>
</pre>
      <p>The element with ID "b" in the following example would have checking enabled (the leading
    space character in the attribute’s value on the <code><a data-link-type="element" href="sec-forms.html#elementdef-input" id="ref-for-elementdef-input-287">input</a></code> element causes the attribute
    to be ignored, so the ancestor’s value is used instead, regardless of the default).</p>
<pre class="bad">&lt;p spellcheck="true"&gt;&lt;label&gt;Name: &lt;input spellcheck=" false"&gt;&lt;/label&gt;
&lt;/p&gt;</pre>
     </div>
    </div>
    <p class="note" role="note"> This specification does not define the user interface for spelling and grammar
  checkers. A user agent could offer on-demand checking, could perform continuous checking while the
  checking is enabled, or could use other interfaces. </p>
    <h3 class="heading settled" data-level="5.7" id="drag-and-drop"><span class="secno">5.7. </span><span class="content">Drag and drop</span><a class="self-link" href="editing.html#drag-and-drop"></a></h3>
    <p>This section defines an event-based drag-and-drop mechanism.</p>
    <p>This specification does not define exactly what a <em>drag-and-drop operation</em> actually
  is.</p>
    <p>On a visual medium with a pointing device, a drag operation could be the default action of a <code>mousedown</code> event that is followed by a series of <code>mousemove</code> events, and the drop could be triggered by the mouse
  being released.</p>
    <p>When using an input modality other than a pointing device, users would probably have to
  explicitly indicate their intention to perform a drag-and-drop operation, stating what they wish
  to drag and where they wish to drop it, respectively.</p>
    <div class="impl">
     <p>However it is implemented, drag-and-drop operations must have a starting point (e.g., where the
  mouse was clicked, or the start of the selection or element that was selected for the drag), may
  have any number of intermediate steps (elements that the mouse moves over during a drag, or
  elements that the user picks as possible drop points as he cycles through possibilities), and must
  either have an end point (the element above which the mouse button was released, or the element
  that was finally selected), or be canceled. The end point must be the last element selected as a
  possible drop point before the drop occurs (so if the operation is not canceled, there must be at
  least one element in the middle step).</p>
    </div>
    <h4 class="heading settled" data-level="5.7.1" id="drag-and-drop-introduction"><span class="secno">5.7.1. </span><span class="content">Introduction</span><a class="self-link" href="editing.html#drag-and-drop-introduction"></a></h4>
    <p><em>This section is non-normative.</em></p>
    <p>To make an element draggable is simple: give the element a <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-draggable" id="ref-for-element-attrdef-global-draggable-3">draggable</a></code> attribute, and set an event listener for <code>dragstart</code> that stores the data being dragged.</p>
    <p>The event handler typically needs to check that it’s not a text selection that is being
  dragged, and then needs to store data into the <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-1">DataTransfer</a></code> object and set the
  allowed effects (copy, move, link, or some combination).</p>
    <p>For example:</p>
<pre class="highlight"><span class="nt">&lt;p&gt;</span>What fruits do you like?<span class="nt">&lt;/p&gt;</span>
<span class="nt">&lt;ol</span> <span class="na">ondragstart=</span><span class="s">"dragStartHandler(event)"</span><span class="nt">&gt;</span>
<span class="nt">&lt;li</span> <span class="na">draggable=</span><span class="s">"true"</span><span class="nt">&gt;</span>Apples<span class="nt">&lt;/li&gt;</span>
<span class="nt">&lt;li</span> <span class="na">draggable=</span><span class="s">"true"</span><span class="nt">&gt;</span>Oranges<span class="nt">&lt;/li&gt;</span>
<span class="nt">&lt;li</span> <span class="na">draggable=</span><span class="s">"true"</span><span class="nt">&gt;</span>Pears<span class="nt">&lt;/li&gt;</span>
<span class="nt">&lt;/ol&gt;</span>
<span class="nt">&lt;script&gt;</span>
var internalDNDType = 'text/x-example'; // set this to something specific to your site
function dragStartHandler(event) {
  if (event.target instanceof HTMLLIElement) {
    // use the element’s&gt;
</pre>
    <hr>
    <p>To accept a drop, the drop target has to have a <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-2">dropzone</a></code> attribute and listen to the <code>drop</code> event.</p>
    <p>The value of the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-3">dropzone</a></code> attribute specifies what kind of
  data to accept (e.g., "<code>string:text/plain</code>" to accept any text strings, or
  "<code>file:image/png</code>" to accept a PNG image file) and what kind of feedback to
  give (e.g., "<code>move</code>" to indicate that the data will be moved).</p>
    <p class="note" role="note"> Instead of using the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-4">dropzone</a></code> attribute, a drop
  target can handle the <code>dragenter</code> event (to report whether or
  not the drop target is to accept the drop) and the <code>dragover</code> event (to specify what feedback is to be shown to the user). </p>
    <p>The <code>drop</code> event allows the actual drop to be performed. This
  event needs to be canceled, so that the <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-dropeffect" id="ref-for-dom-datatransfer-dropeffect-1">dropEffect</a></code> attribute’s value can be used by the source
  (otherwise it’s reset).</p>
    <p>For example:</p>
<pre class="highlight"><span class="nt">&lt;p&gt;</span>Drop your favorite fruits below:<span class="nt">&lt;/p&gt;</span>
<span class="nt">&lt;ol</span> <span class="na">dropzone=</span><span class="s">"move string:text/x-example"</span> <span class="na">ondrop=</span><span class="s">"dropHandler(event)"</span><span class="nt">&gt;</span>
<span class="c">&lt;!-- don’t forget to change the "text/x-example" type to something</span>
<span class="c">specific to your site --&gt;</span>
<span class="nt">&lt;/ol&gt;</span>
<span class="nt">&lt;script&gt;</span>
<span class="kd">var</span> <span class="nx">internalDNDType</span> <span class="o">=</span> <span class="s1">'text/x-example'</span><span class="p">;</span> <span class="c1">// set this to something specific to your site</span>
<span class="kd">function</span> <span class="nx">dropHandler</span><span class="p">(</span><span class="nx">event</span><span class="p">)</span> <span class="p">{</span>
  <span class="kd">var</span> <span class="nx">li</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s1">'li'</span><span class="p">);</span>
  <span class="kd">var</span> <span class="nx">data</span> <span class="o">=</span> <span class="nx">event</span><span class="p">.</span><span class="nx">dataTransfer</span><span class="p">.</span><span class="nx">getData</span><span class="p">(</span><span class="nx">internalDNDType</span><span class="p">);</span>
  <span class="k">if</span> <span class="p">(</span><span class="nx">data</span> <span class="o">==</span> <span class="s1">'fruit-apple'</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">li</span><span class="p">.</span><span class="nx">textContent</span> <span class="o">=</span> <span class="s1">'Apples'</span><span class="p">;</span>
  <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">data</span> <span class="o">==</span> <span class="s1">'fruit-orange'</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">li</span><span class="p">.</span><span class="nx">textContent</span> <span class="o">=</span> <span class="s1">'Oranges'</span><span class="p">;</span>
  <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">data</span> <span class="o">==</span> <span class="s1">'fruit-pear'</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">li</span><span class="p">.</span><span class="nx">textContent</span> <span class="o">=</span> <span class="s1">'Pears'</span><span class="p">;</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
    <span class="nx">li</span><span class="p">.</span><span class="nx">textContent</span> <span class="o">=</span> <span class="s1">'Unknown Fruit'</span><span class="p">;</span>
  <span class="p">}</span>
  <span class="nx">event</span><span class="p">.</span><span class="nx">target</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">li</span><span class="p">);</span>
<span class="p">}</span>
<span class="nt">&lt;/script&gt;</span>
</pre>
    <hr>
    <p>To remove the original element (the one that was dragged) from the display, the <code>dragend</code> event can be used.</p>
    <p>For our example here, that means updating the original markup to handle that event:</p>
<pre class="highlight"><span class="nt">&lt;p&gt;</span>What fruits do you like?<span class="nt">&lt;/p&gt;</span>
<span class="nt">&lt;ol</span> <span class="na">ondragstart=</span><span class="s">"dragStartHandler(event)"</span> <span class="na">ondragend=</span><span class="s">"dragEndHandler(event)"</span><span class="nt">&gt;</span>
  <span class="c">&lt;!-- ...as before... --&gt;</span>
<span class="nt">&lt;/ol&gt;</span>
<span class="nt">&lt;script&gt;</span>
<span class="kd">function</span> <span class="nx">dragStartHandler</span><span class="p">(</span><span class="nx">event</span><span class="p">)</span> <span class="p">{</span>
  <span class="c1">// ...as before...</span>
<span class="p">}</span>
<span class="kd">function</span> <span class="nx">dragEndHandler</span><span class="p">(</span><span class="nx">event</span><span class="p">)</span> <span class="p">{</span>
  <span class="k">if</span> <span class="p">(</span><span class="nx">event</span><span class="p">.</span><span class="nx">dataTransfer</span><span class="p">.</span><span class="nx">dropEffect</span> <span class="o">==</span> <span class="s1">'move'</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// remove the dragged element</span>
    <span class="nx">event</span><span class="p">.</span><span class="nx">target</span><span class="p">.</span><span class="nx">parentNode</span><span class="p">.</span><span class="nx">removeChild</span><span class="p">(</span><span class="nx">event</span><span class="p">.</span><span class="nx">target</span><span class="p">);</span>
  <span class="p">}</span>
<span class="p">}</span>
<span class="nt">&lt;/script&gt;</span>
</pre>
    <h4 class="heading settled" data-level="5.7.2" id="the-drag-data-store"><span class="secno">5.7.2. </span><span class="content">The drag data store</span><a class="self-link" href="editing.html#the-drag-data-store"></a></h4>
    <p>The data that underlies a drag-and-drop operation, known as the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="drag-data-store">drag data store</dfn>,
  consists of the following information:</p>
    <ul>
     <li>
      A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="drag-data-store-item-list">drag data store item list</dfn>, which is a list of items representing the dragged
    data, each consisting of the following information: 
      <dl>
       <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="a drag data item kind|The drag data item kind|drag data item kind" data-noexport="" id="a-drag-data-item-kind">The drag data item kind</dfn>
       </dt><dd>
        <p>The kind of data:</p>
        <dl>
         <dt><i>Plain Unicode string</i>
         </dt><dd> Text. 
         </dd><dt><i>File</i>
         </dt><dd> Binary data with a file name. 
        </dd></dl>
       </dd><dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="item type string|The drag data item type string|type string|a drag data item type string|drag data item type strings|drag data item type string" data-noexport="" id="item-type-string">The drag data item type string</dfn>
       </dt><dd>
        <p>A Unicode string giving the type or format of the data, generally given by a <a data-link-type="dfn" href="infrastructure.html#mime-type" id="ref-for-mime-type-29">MIME
      type</a>. Some values that are not <a data-link-type="dfn" href="infrastructure.html#mime-type" id="ref-for-mime-type-30">MIME types</a> are
      special-cased for legacy reasons. The API does not enforce the use of <a data-link-type="dfn" href="infrastructure.html#mime-type" id="ref-for-mime-type-31">MIME types</a>; other values can be used as well. In all cases, however, the values
      are all <a data-link-type="dfn" href="https://www.w3.org/TR/dom/#converted-to-ascii-lowercase">converted to ASCII lowercase</a> by the API.</p>
        <p class="note" role="note"> Strings that contain <a data-link-type="dfn" href="infrastructure.html#space-characters" id="ref-for-space-characters-57">space characters</a> cannot be used with the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-5">dropzone</a></code> attribute, so authors are
      encouraged to use only <a data-link-type="dfn" href="infrastructure.html#mime-type" id="ref-for-mime-type-32">MIME types</a> or custom strings (without
      spaces). </p>
        <p>There is a limit of one <i>Plain Unicode string</i> item per <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-1">item type string</a>.</p>
       </dd><dt>The actual data
       </dt><dd>A Unicode or binary string, in some cases with a file name (itself a Unicode string),
      as per <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-1">the drag data item kind</a>.
      </dd></dl>
      <p>The <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-1">drag data store item list</a> is ordered in the order that the items were added
    to the list; most recently added last.</p>
     </li><li>
      <p>The following information, used to generate the UI feedback during the drag:</p>
      <ul>
       <li>User-agent-defined default feedback information, known as the <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="drag data store default feedback" data-noexport="" id="drag-data-store-default-feedback">drag data store default
      feedback</dfn>.
       </li><li>Optionally, a bitmap image and the coordinate of a point within that image, known as the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="drag-data-store-bitmap">drag data store bitmap</dfn> and <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="drag-data-store-hot-spot-coordinate">drag data store hot spot coordinate</dfn>.
      </li></ul>
     </li><li>
      <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="drag-data-store-mode">drag data store mode</dfn>, which is one of the following:</p>
      <dl>
       <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="read-write-mode">Read/write mode</dfn>
       </dt><dd>
        <p>For the <code>dragstart</code> event. New data can be added to the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-1">drag data store</a>.</p>
       </dd><dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="read-only-mode">Read-only mode</dfn>
       </dt><dd>
        <p>For the <code>drop</code> event. The list of items representing dragged
      data can be read, including the data. No new data can be added.</p>
       </dd><dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="protected-mode">Protected mode</dfn>
       </dt><dd>
        <p>For all other events. The formats and kinds in the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-2">drag data store</a> list of
      items representing dragged data can be enumerated, but the data itself is unavailable and no
      new data can be added.</p>
      </dd></dl>
     </li><li>
      <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="drag-data-store-allowed-effects-state">drag data store allowed effects state</dfn>, which is a string.</p>
    </li></ul>
    <p>When a <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-3">drag data store</a> is <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="create a drag data store" data-noexport="" id="create-a-drag-data-store">created</dfn>, it
  must be initialized such that its <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-2">drag data store item list</a> is empty, it has no <a data-link-type="dfn" href="editing.html#drag-data-store-default-feedback" id="ref-for-drag-data-store-default-feedback-1">drag data store default feedback</a>, it has no <a data-link-type="dfn" href="editing.html#drag-data-store-bitmap" id="ref-for-drag-data-store-bitmap-1">drag data store bitmap</a> and <a data-link-type="dfn" href="editing.html#drag-data-store-hot-spot-coordinate" id="ref-for-drag-data-store-hot-spot-coordinate-1">drag data store hot spot coordinate</a>, its <a data-link-type="dfn" href="editing.html#drag-data-store-mode" id="ref-for-drag-data-store-mode-1">drag data store mode</a> is <a data-link-type="dfn" href="editing.html#protected-mode" id="ref-for-protected-mode-1">protected mode</a>, and its <a data-link-type="dfn" href="editing.html#drag-data-store-allowed-effects-state" id="ref-for-drag-data-store-allowed-effects-state-1">drag data store allowed effects
  state</a> is the string "<code>uninitialized</code>".</p>
    <h4 class="heading settled" data-level="5.7.3" id="the-datatransfer-interface"><span class="secno">5.7.3. </span><span class="content">The <code>DataTransfer</code> interface</span><a class="self-link" href="editing.html#the-datatransfer-interface"></a></h4>
    <p><code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-2">DataTransfer</a></code> objects are used to expose the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-4">drag data store</a> that
  underlies a drag-and-drop operation.</p>
<pre class="idl highlight def" data-highlight="webidl"><span class="kt">interface</span> <dfn class="nv dfn-paneled idl-code" data-dfn-for="DataTransfer" data-dfn-type="interface" data-export="" id="datatransfer-datatransfer">DataTransfer</dfn> {
  <span class="kt">attribute</span> <span class="kt">DOMString</span> <a class="nv idl-code" data-link-type="attribute" data-type="DOMString" href="editing.html#dom-datatransfer-dropeffect" id="ref-for-dom-datatransfer-dropeffect-2">dropEffect</a>;
  <span class="kt">attribute</span> <span class="kt">DOMString</span> <a class="nv idl-code" data-link-type="attribute" data-type="DOMString" href="editing.html#dom-datatransfer-effectallowed" id="ref-for-dom-datatransfer-effectallowed-1">effectAllowed</a>;

  [<a class="nv idl-code" data-link-type="extended-attribute">SameObject</a>] <span class="kt">readonly</span> <span class="kt">attribute</span> <a class="n" data-link-type="idl-name" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-1">DataTransferItemList</a> <a class="nv idl-code" data-link-type="attribute" data-readonly="" data-type="DataTransferItemList" href="editing.html#dom-datatransfer-items" id="ref-for-dom-datatransfer-items-1">items</a>;

  <span class="kt">void</span> <a class="nv idl-code" data-link-type="method" href="editing.html#dom-datatransfer-setdragimage" id="ref-for-dom-datatransfer-setdragimage-1">setDragImage</a>(<a class="n" data-link-type="idl-name" href="https://www.w3.org/TR/dom/#interface-element">Element</a> <dfn class="nv idl-code" data-dfn-for="DataTransfer/setDragImage(image, x, y)" data-dfn-type="argument" data-export="" id="dom-datatransfer-setdragimage-image-x-y-image">image<a class="self-link" href="editing.html#dom-datatransfer-setdragimage-image-x-y-image"></a></dfn>, <span class="kt">long</span> <dfn class="nv idl-code" data-dfn-for="DataTransfer/setDragImage(image, x, y)" data-dfn-type="argument" data-export="" id="dom-datatransfer-setdragimage-image-x-y-x">x<a class="self-link" href="editing.html#dom-datatransfer-setdragimage-image-x-y-x"></a></dfn>, <span class="kt">long</span> <dfn class="nv idl-code" data-dfn-for="DataTransfer/setDragImage(image, x, y)" data-dfn-type="argument" data-export="" id="dom-datatransfer-setdragimage-image-x-y-y">y<a class="self-link" href="editing.html#dom-datatransfer-setdragimage-image-x-y-y"></a></dfn>);

  /* old interface */
  [<a class="nv idl-code" data-link-type="extended-attribute">SameObject</a>] <span class="kt">readonly</span> <span class="kt">attribute</span> <span class="kt">DOMString</span>[] <a class="nv idl-code" data-link-type="attribute" data-readonly="" data-type="DOMString[]" href="editing.html#dom-datatransfer-types" id="ref-for-dom-datatransfer-types-1">types</a>;
  <span class="kt">DOMString</span> <a class="nv idl-code" data-link-type="method" href="editing.html#dom-datatransfer-getdata" id="ref-for-dom-datatransfer-getdata-1">getData</a>(<span class="kt">DOMString</span> <dfn class="nv idl-code" data-dfn-for="DataTransfer/getData(format)" data-dfn-type="argument" data-export="" id="dom-datatransfer-getdata-format-format">format<a class="self-link" href="editing.html#dom-datatransfer-getdata-format-format"></a></dfn>);
  <span class="kt">void</span> <a class="nv idl-code" data-link-type="method" href="editing.html#dom-datatransfer-setdata" id="ref-for-dom-datatransfer-setdata-1">setData</a>(<span class="kt">DOMString</span> <dfn class="nv idl-code" data-dfn-for="DataTransfer/setData(format, data)" data-dfn-type="argument" data-export="" id="dom-datatransfer-setdata-format-data-format">format<a class="self-link" href="editing.html#dom-datatransfer-setdata-format-data-format"></a></dfn>, <span class="kt">DOMString</span> <dfn class="nv idl-code" data-dfn-for="DataTransfer/setData(format, data)" data-dfn-type="argument" data-export="" id="dom-datatransfer-setdata-format-data-data">data<a class="self-link" href="editing.html#dom-datatransfer-setdata-format-data-data"></a></dfn>);
  <span class="kt">void</span> <a class="nv idl-code" data-link-type="method" href="editing.html#dom-datatransfer-cleardata" id="ref-for-dom-datatransfer-cleardata-1">clearData</a>(<span class="kt">optional</span> <span class="kt">DOMString</span> <dfn class="nv idl-code" data-dfn-for="DataTransfer/clearData(format), DataTransfer/clearData()" data-dfn-type="argument" data-export="" id="dom-datatransfer-cleardata-format-format">format<a class="self-link" href="editing.html#dom-datatransfer-cleardata-format-format"></a></dfn>);
  [<a class="nv idl-code" data-link-type="extended-attribute">SameObject</a>] <span class="kt">readonly</span> <span class="kt">attribute</span> <a class="n" data-link-type="idl-name" href="https://www.w3.org/TR/FileAPI/#dfn-filelist">FileList</a> <a class="nv idl-code" data-link-type="attribute" data-readonly="" data-type="FileList" href="editing.html#dom-datatransfer-files" id="ref-for-dom-datatransfer-files-1">files</a>;
};
</pre>
    <dl class="domintro">
     <dt><var>dataTransfer</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-dropeffect" id="ref-for-dom-datatransfer-dropeffect-3">dropEffect</a></code> [ = <var>value</var> ]
     </dt><dd>
      <p>Returns the kind of operation that is currently selected. If the kind of operation isn’t one
    of those that is allowed by the <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-effectallowed" id="ref-for-dom-datatransfer-effectallowed-2">effectAllowed</a></code> attribute, then the operation will
    fail.</p>
      <p>Can be set, to change the selected operation.</p>
      <p>The possible values are "<code>none</code>", "<code>copy</code>", "<code>link</code>", and "<code>move</code>".</p>
     </dd><dt><var>dataTransfer</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-effectallowed" id="ref-for-dom-datatransfer-effectallowed-3">effectAllowed</a></code> [ = <var>value</var> ]
     </dt><dd>
      <p>Returns the kinds of operations that are to be allowed.</p>
      <p>Can be set (during the <code>dragstart</code> event), to change
    the allowed operations.</p>
      <p>The possible values are "<code>none</code>",
    "<code>copy</code>", "<code>copyLink</code>", "<code>copyMove</code>", "<code>link</code>", "<code>linkMove</code>", "<code>move</code>", "<code>all</code>", and "<code>uninitialized</code>",</p>
     </dd><dt><var>dataTransfer</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-items" id="ref-for-dom-datatransfer-items-2">items</a></code>
     </dt><dd>
      <p>Returns a <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-2">DataTransferItemList</a></code> object, with the drag data.</p>
     </dd><dt><var>dataTransfer</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-setdragimage" id="ref-for-dom-datatransfer-setdragimage-2">setDragImage</a></code>(<var>element</var>, <var>x</var>, <var>y</var>)
     </dt><dd>
      <p>Uses the given element to update the drag feedback, replacing any previously specified
    feedback.</p>
     </dd><dt><var>dataTransfer</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-types" id="ref-for-dom-datatransfer-types-2">types</a></code>
     </dt><dd>
      <p>Returns an array listing the formats that were set in the <code>dragstart</code> event. In addition, if any files are being dragged,
    then one of the types will be the string "<code>Files</code>".</p>
     </dd><dt><var>data</var> = <var>dataTransfer</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-getdata" id="ref-for-dom-datatransfer-getdata-2">getData</a></code>(<var>format</var>)
     </dt><dd>
      <p>Returns the specified data. If there is no such data, returns the empty string.</p>
     </dd><dt><var>dataTransfer</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-setdata" id="ref-for-dom-datatransfer-setdata-2">setData</a></code>(<var>format</var>, <var>data</var>)
     </dt><dd>
      <p>Adds the specified data.</p>
     </dd><dt><var>dataTransfer</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-cleardata" id="ref-for-dom-datatransfer-cleardata-2">clearData</a></code>( [ <var>format</var> ] )
     </dt><dd>
      <p>Removes the data of the specified formats. Removes all data if the argument is omitted.</p>
     </dd><dt><var>dataTransfer</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-files" id="ref-for-dom-datatransfer-files-2">files</a></code>
     </dt><dd>
      <p>Returns a <code>FileList</code> of the files being dragged, if any.</p>
    </dd></dl>
    <p><code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-3">DataTransfer</a></code> objects are used during the <a data-link-type="dfn" href="editing.html#drag-and-drop-events" id="ref-for-drag-and-drop-events-1">drag-and-drop events</a>, and are only valid while those events are being fired.</p>
    <div class="impl">
     <p>A <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-4">DataTransfer</a></code> object is associated with a <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-5">drag data store</a> while it
  is valid.</p>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransfer" data-dfn-type="attribute" data-export="" id="dom-datatransfer-dropeffect"><code>dropEffect</code></dfn> attribute controls
  the drag-and-drop feedback that the user is given during a drag-and-drop operation. When the <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-5">DataTransfer</a></code> object is created, the <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-dropeffect" id="ref-for-dom-datatransfer-dropeffect-4">dropEffect</a></code> attribute is set to a string value. On
  getting, it must return its current value. On setting, if the new value is one of "<dfn class="css" data-dfn-for="dropEffect" data-dfn-type="value" data-export="" id="valdef-dropeffect-none"><code>none</code><a class="self-link" href="editing.html#valdef-dropeffect-none"></a></dfn>", "<dfn class="css" data-dfn-for="dropEffect" data-dfn-type="value" data-export="" id="valdef-dropeffect-copy"><code>copy</code><a class="self-link" href="editing.html#valdef-dropeffect-copy"></a></dfn>", "<dfn class="css" data-dfn-for="dropEffect" data-dfn-type="value" data-export="" id="valdef-dropeffect-link"><code>link</code><a class="self-link" href="editing.html#valdef-dropeffect-link"></a></dfn>", or "<dfn class="css" data-dfn-for="dropEffect" data-dfn-type="value" data-export="" id="valdef-dropeffect-move"><code>move</code><a class="self-link" href="editing.html#valdef-dropeffect-move"></a></dfn>", then the attribute’s current value must be
  set to the new value. Other values must be ignored.</p>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransfer" data-dfn-type="attribute" data-export="" id="dom-datatransfer-effectallowed"><code>effectAllowed</code></dfn> attribute is
  used in the drag-and-drop processing model to initialize the <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-dropeffect" id="ref-for-dom-datatransfer-dropeffect-5">dropEffect</a></code> attribute during the <code>dragenter</code> and <code>dragover</code> events. When the <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-6">DataTransfer</a></code> object is
  created, the <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-effectallowed" id="ref-for-dom-datatransfer-effectallowed-4">effectAllowed</a></code> attribute is set
  to a string value. On getting, it must return its current value. On setting, if <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-6">drag data
  store</a>’s mode is the <a data-link-type="dfn" href="editing.html#read-write-mode" id="ref-for-read-write-mode-1">read/write mode</a> and the new value is one of "<dfn class="css" data-dfn-for="effectAllowed" data-dfn-type="value" data-export="" id="valdef-effectallowed-none"><code>none</code><a class="self-link" href="editing.html#valdef-effectallowed-none"></a></dfn>", "<dfn class="css" data-dfn-for="effectAllowed" data-dfn-type="value" data-export="" id="valdef-effectallowed-copy"><code>copy</code><a class="self-link" href="editing.html#valdef-effectallowed-copy"></a></dfn>", "<dfn class="css" data-dfn-for="effectAllowed" data-dfn-type="value" data-export="" id="valdef-effectallowed-copylink"><code>copyLink</code><a class="self-link" href="editing.html#valdef-effectallowed-copylink"></a></dfn>", "<dfn class="css" data-dfn-for="effectAllowed" data-dfn-type="value" data-export="" id="valdef-effectallowed-copymove"><code>copyMove</code><a class="self-link" href="editing.html#valdef-effectallowed-copymove"></a></dfn>", "<dfn class="css" data-dfn-for="effectAllowed" data-dfn-type="value" data-export="" id="valdef-effectallowed-link"><code>link</code><a class="self-link" href="editing.html#valdef-effectallowed-link"></a></dfn>", "<dfn class="css" data-dfn-for="effectAllowed" data-dfn-type="value" data-export="" id="valdef-effectallowed-linkmove"><code>linkMove</code><a class="self-link" href="editing.html#valdef-effectallowed-linkmove"></a></dfn>", "<dfn class="css" data-dfn-for="effectAllowed" data-dfn-type="value" data-export="" id="valdef-effectallowed-move"><code>move</code><a class="self-link" href="editing.html#valdef-effectallowed-move"></a></dfn>", "<dfn class="css" data-dfn-for="effectAllowed" data-dfn-type="value" data-export="" id="valdef-effectallowed-all"><code>all</code><a class="self-link" href="editing.html#valdef-effectallowed-all"></a></dfn>", or "<dfn class="css" data-dfn-for="effectAllowed" data-dfn-type="value" data-export="" id="valdef-effectallowed-uninitialized"><code>uninitialized</code><a class="self-link" href="editing.html#valdef-effectallowed-uninitialized"></a></dfn>", then the attribute’s
  current value must be set to the new value. Otherwise it must be left unchanged.</p>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransfer" data-dfn-type="attribute" data-export="" id="dom-datatransfer-items"><code>items</code></dfn> attribute must return a <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-3">DataTransferItemList</a></code> object associated with the <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-7">DataTransfer</a></code> object.</p>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransfer" data-dfn-type="method" data-export="" data-lt="setDragImage(image, x, y)" id="dom-datatransfer-setdragimage"><code>setDragImage(<var>element</var>, <var>x</var>, <var>y</var>)</code></dfn> method must run the following steps:</p>
     <ol>
      <li>If the <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-8">DataTransfer</a></code> object is no longer associated with a <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-7">drag data
    store</a>, abort these steps. Nothing happens.
      </li><li>If the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-8">drag data store</a>’s mode is
    not the <a data-link-type="dfn" href="editing.html#read-write-mode" id="ref-for-read-write-mode-2">read/write mode</a>, abort these steps. Nothing
    happens.
      </li><li>If the <var>element</var> argument is an <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-img" id="ref-for-elementdef-img-147">img</a></code> element, then set the <a data-link-type="dfn" href="editing.html#drag-data-store-bitmap" id="ref-for-drag-data-store-bitmap-2">drag
    data store bitmap</a> to the element’s image (at its <a data-link-type="dfn" href="https://www.w3.org/TR/css-sizing-3/#intrinsic-sizing">intrinsic size</a>); otherwise, set the <a data-link-type="dfn" href="editing.html#drag-data-store-bitmap" id="ref-for-drag-data-store-bitmap-3">drag data store bitmap</a> to an image generated from the given element (the exact
    mechanism for doing so is not currently specified).
      </li><li>Set the <a data-link-type="dfn" href="editing.html#drag-data-store-hot-spot-coordinate" id="ref-for-drag-data-store-hot-spot-coordinate-2">drag data store hot spot coordinate</a> to the given <var>x</var>, <var>y</var> coordinate.
     </li></ol>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransfer" data-dfn-type="attribute" data-export="" id="dom-datatransfer-types"><code>types</code></dfn> attribute must return a <a data-link-type="dfn" href="infrastructure.html#live" id="ref-for-live-11">live</a> <a data-link-type="dfn" href="https://www.w3.org/TR/WebIDL-1/#dfn-read-only">read only</a> array giving the strings
  that the following steps would produce.</p>
     <ol>
      <li>Start with an empty list <var>L</var>.
      </li><li>If the <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-9">DataTransfer</a></code> object is no longer associated with a <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-9">drag data
    store</a>, the array is empty. Abort these steps; return the empty list <var>L</var>.
      </li><li>For each item in the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-3">drag data store item list</a> whose <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-1">kind</a></code> is <i>Plain Unicode string</i>, add an
    entry to the list <var>L</var> consisting of the item’s <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-2">type string</a>.
      </li><li>If there are any items in the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-4">drag data store item list</a> whose <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-2">kind</a></code> is <i>File</i>, then add an entry to the list <var>L</var> consisting of the string "<code>Files</code>". (This value can be
    distinguished from the other values because it is not lowercase.)
      </li><li>The strings produced by these steps are those in the list <var>L</var>.
     </li></ol>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransfer" data-dfn-type="method" data-export="" id="dom-datatransfer-getdata"><code>getData(<var>format</var>)</code></dfn> method
  must run the following steps:</p>
     <ol>
      <li>If the <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-10">DataTransfer</a></code> object is no longer associated with a <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-10">drag data
    store</a>, return the empty string and abort these steps.
      </li><li>If the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-11">drag data store</a>’s mode is
    the <a data-link-type="dfn" href="editing.html#protected-mode" id="ref-for-protected-mode-2">protected mode</a>, return the empty string and abort these
    steps.
      </li><li>Let <var>format</var> be the first argument, <a data-link-type="dfn" href="https://www.w3.org/TR/dom/#converted-to-ascii-lowercase">converted to ASCII
    lowercase</a>.
      </li><li>Let <var>convert-to-URL</var> be false.
      </li><li>If <var>format</var> equals "<code>text</code>", change it to "<code>text/plain</code>".
      </li><li>If <var>format</var> equals "<code>url</code>", change it to "<code>text/uri-list</code>" and set <var>convert-to-URL</var> to true.
      </li><li>If there is no item in the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-5">drag data store item list</a> whose <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-3">kind</a></code> is <i>Plain Unicode string</i> and whose <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-3">type string</a> is equal to <var>format</var>, return the empty string
    and abort these steps.
      </li><li>Let <var>result</var> be the data of the item in the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-6">drag data store item
    list</a> whose <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-4">kind</a></code> is <i>Plain Unicode
    string</i> and whose <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-4">type string</a> is equal to <var>format</var>.
      </li><li>If <var>convert-to-URL</var> is true, then parse <var>result</var> as appropriate for <code>text/uri-list</code> data, and then set <var>result</var> to the first URL from
    the list, if any, or the empty string otherwise. <a data-link-type="biblio" href="references.html#biblio-rfc2483">[RFC2483]</a>
      </li><li>Return <var>result</var>.
     </li></ol>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransfer" data-dfn-type="method" data-export="" id="dom-datatransfer-setdata"><code>setData(<var>format</var>, <var>data</var>)</code></dfn> method must run the following steps:</p>
     <ol>
      <li>If the <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-11">DataTransfer</a></code> object is no longer associated with a <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-12">drag data
    store</a>, abort these steps. Nothing happens.
      </li><li>If the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-13">drag data store</a>’s mode is
    not the <a data-link-type="dfn" href="editing.html#read-write-mode" id="ref-for-read-write-mode-3">read/write mode</a>, abort these steps. Nothing
    happens.
      </li><li>Let <var>format</var> be the first argument, <a data-link-type="dfn" href="https://www.w3.org/TR/dom/#converted-to-ascii-lowercase">converted to ASCII
    lowercase</a>.
      </li><li>
       <p>If <var>format</var> equals "<code>text</code>", change it to "<code>text/plain</code>".</p>
       <p>If <var>format</var> equals "<code>url</code>", change it to "<code>text/uri-list</code>".</p>
      </li><li>Remove the item in the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-7">drag data store item list</a> whose <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-5">kind</a></code> is <i>Plain Unicode string</i> and whose <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-5">type string</a> is equal to <var>format</var>, if there is
    one.
      </li><li>Add an item to the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-8">drag data store item list</a> whose <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-6">kind</a></code> is <i>Plain Unicode string</i>, whose <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-6">type string</a> is equal to <var>format</var>, and whose data is the string
    given by the method’s second argument.
     </li></ol>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransfer" data-dfn-type="method" data-export="" data-lt="clearData(format)|clearData()" id="dom-datatransfer-cleardata"><code>clearData()</code></dfn> method must run the
  following steps:</p>
     <ol>
      <li>If the <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-12">DataTransfer</a></code> object is no longer associated with a <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-14">drag data
    store</a>, abort these steps. Nothing happens.
      </li><li>If the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-15">drag data store</a>’s mode is
    not the <a data-link-type="dfn" href="editing.html#read-write-mode" id="ref-for-read-write-mode-4">read/write mode</a>, abort these steps. Nothing
    happens.
      </li><li>If the method was called with no arguments, remove each item in the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-9">drag data store
    item list</a> whose <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-7">kind</a></code> is <i>Plain Unicode
    string</i>, and abort these steps.
      </li><li>Let <var>format</var> be the first argument, <a data-link-type="dfn" href="https://www.w3.org/TR/dom/#converted-to-ascii-lowercase">converted to ASCII
    lowercase</a>.
      </li><li>
       <p>If <var>format</var> equals "<code>text</code>", change it to "<code>text/plain</code>".</p>
       <p>If <var>format</var> equals "<code>url</code>", change it to "<code>text/uri-list</code>".</p>
      </li><li>Remove the item in the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-10">drag data store item list</a> whose <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-8">kind</a></code> is <i>Plain Unicode string</i> and whose <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-7">type string</a> is equal to <var>format</var>, if there is
    one.
     </li></ol>
     <p class="note" role="note"> The <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-cleardata" id="ref-for-dom-datatransfer-cleardata-3">clearData()</a></code> method does not
  affect whether any files were included in the drag, so the <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-types" id="ref-for-dom-datatransfer-types-3">types</a></code> attribute’s list might still not be empty after
  calling <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-cleardata" id="ref-for-dom-datatransfer-cleardata-4">clearData()</a></code> (it would still contain the
  "<code>Files</code>" string if any files were included in the drag). </p>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransfer" data-dfn-type="attribute" data-export="" id="dom-datatransfer-files"><code>files</code></dfn> attribute must return a <a data-link-type="dfn" href="infrastructure.html#live" id="ref-for-live-12">live</a> <code>FileList</code> sequence consisting of <code>File</code> objects
  representing the files found by the following steps.
  Furthermore, for a given <code>FileList</code> object and a given underlying file, the same <code>File</code> object must be used each time.</p>
     <ol>
      <li>Start with an empty list <var>L</var>.
      </li><li>If the <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-13">DataTransfer</a></code> object is no longer associated with a <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-16">drag data
    store</a>, the <code>FileList</code> is empty. Abort these steps; return the empty list <var>L</var>.
      </li><li>If the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-17">drag data store</a>’s mode is
    the <a data-link-type="dfn" href="editing.html#protected-mode" id="ref-for-protected-mode-3">protected mode</a>, abort these steps; return the empty list <var>L</var>.
      </li><li>For each item in the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-11">drag data store item list</a> whose <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-9">kind</a></code> is <i>File</i> , add the item’s data (the file, in particular its name and contents, as well as
    its <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-request-type">type</a>) to the list <var>L</var>.
      </li><li>The files found by these steps are those in the list <var>L</var>.
     </li></ol>
     <p class="note" role="note"> This version of the API does not expose the types of the files during the
  drag. </p>
    </div>
    <h5 class="heading settled" data-level="5.7.3.1" id="the-datatransferitemlist-interface"><span class="secno">5.7.3.1. </span><span class="content">The <code>DataTransferItemList</code> interface</span><a class="self-link" href="editing.html#the-datatransferitemlist-interface"></a></h5>
    <p>Each <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-14">DataTransfer</a></code> object is associated with a <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-4">DataTransferItemList</a></code> object.</p>
<pre class="idl highlight def" data-highlight="webidl"><span class="kt">interface</span> <dfn class="nv dfn-paneled idl-code" data-dfn-for="DataTransferItemList" data-dfn-type="interface" data-export="" id="datatransferitemlist-datatransferitemlist">DataTransferItemList</dfn> {
  <span class="kt">readonly</span> <span class="kt">attribute</span> <span class="kt">unsigned</span> <span class="kt">long</span> <a class="nv idl-code" data-link-type="attribute" data-readonly="" data-type="unsigned long" href="editing.html#dom-datatransferitemlist-length" id="ref-for-dom-datatransferitemlist-length-1">length</a>;
  <span class="kt">getter</span> <a class="n" data-link-type="idl-name" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-1">DataTransferItem</a> (<span class="kt">unsigned</span> <span class="kt">long</span> <dfn class="nv idl-code" data-dfn-for="DataTransferItemList/__getter__(index)" data-dfn-type="argument" data-export="" id="dom-datatransferitemlist-__getter__-index-index">index<a class="self-link" href="editing.html#dom-datatransferitemlist-__getter__-index-index"></a></dfn>);
  <a class="n" data-link-type="idl-name" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-2">DataTransferItem</a>? <a class="nv idl-code" data-link-type="method" href="editing.html#dom-datatransferitemlist-add" id="ref-for-dom-datatransferitemlist-add-1">add</a>(<span class="kt">DOMString</span> <dfn class="nv idl-code" data-dfn-for="DataTransferItemList/add(data, type)" data-dfn-type="argument" data-export="" id="dom-datatransferitemlist-add-data-type-data">data<a class="self-link" href="editing.html#dom-datatransferitemlist-add-data-type-data"></a></dfn>, <span class="kt">DOMString</span> <dfn class="nv idl-code" data-dfn-for="DataTransferItemList/add(data, type)" data-dfn-type="argument" data-export="" id="dom-datatransferitemlist-add-data-type-type">type<a class="self-link" href="editing.html#dom-datatransferitemlist-add-data-type-type"></a></dfn>);
  <a class="n" data-link-type="idl-name" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-3">DataTransferItem</a>? <a class="nv idl-code" data-link-type="method" href="editing.html#dom-datatransferitemlist-add" id="ref-for-dom-datatransferitemlist-add-2">add</a>(<a class="n" data-link-type="idl-name" href="https://www.w3.org/TR/FileAPI/#dfn-file">File</a> <dfn class="nv idl-code" data-dfn-for="DataTransferItemList/add(data)" data-dfn-type="argument" data-export="" id="dom-datatransferitemlist-add-data-data">data<a class="self-link" href="editing.html#dom-datatransferitemlist-add-data-data"></a></dfn>);
  <span class="kt">void</span> <a class="nv idl-code" data-link-type="method" href="editing.html#dom-datatransferitemlist-remove" id="ref-for-dom-datatransferitemlist-remove-1">remove</a>(<span class="kt">unsigned</span> <span class="kt">long</span> <dfn class="nv idl-code" data-dfn-for="DataTransferItemList/remove(index)" data-dfn-type="argument" data-export="" id="dom-datatransferitemlist-remove-index-index">index<a class="self-link" href="editing.html#dom-datatransferitemlist-remove-index-index"></a></dfn>);
  <span class="kt">void</span> <a class="nv idl-code" data-link-type="method" href="editing.html#dom-datatransferitemlist-clear" id="ref-for-dom-datatransferitemlist-clear-1">clear</a>();
};
</pre>
    <dl class="domintro">
     <dt><var>items</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitemlist-length" id="ref-for-dom-datatransferitemlist-length-2">length</a></code>
     </dt><dd>Returns the number of items in the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-18">drag data store</a>.
     </dd><dt><var>items</var>[<var>index</var>]
     </dt><dd>
      <p>Returns the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-4">DataTransferItem</a></code> object representing the <var>index</var>th
    entry in the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-19">drag data store</a>.</p>
     </dd><dt><var>items</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitemlist-remove" id="ref-for-dom-datatransferitemlist-remove-2">remove</a></code>(<var>index</var>)
     </dt><dd>
      <p>Removes the <var>index</var>th entry in the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-20">drag data store</a>.</p>
     </dd><dt><var>items</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitemlist-clear" id="ref-for-dom-datatransferitemlist-clear-2">clear()</a></code>
     </dt><dd>
      <p>Removes all the entries in the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-21">drag data store</a>.</p>
     </dd><dt><var>items</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitemlist-add" id="ref-for-dom-datatransferitemlist-add-3">add</a></code>(<var>data</var>)
     </dt><dt><var>items</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitemlist-add" id="ref-for-dom-datatransferitemlist-add-4">add</a></code>(<var>data</var>, <var>type</var>)
     </dt><dd>
      <p>Adds a new entry for the given data to the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-22">drag data store</a>. If the data is plain
    text  then a <var>type</var> string has to be provided
    also.</p>
    </dd></dl>
    <div class="impl">
     <p>While the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-5">DataTransferItemList</a></code> object’s <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-15">DataTransfer</a></code> object is
  associated with a <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-23">drag data store</a>, the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-6">DataTransferItemList</a></code> object’s <i>mode</i> is the same as the <a data-link-type="dfn" href="editing.html#drag-data-store-mode" id="ref-for-drag-data-store-mode-2">drag data store mode</a>. When the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-7">DataTransferItemList</a></code> object’s <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-16">DataTransfer</a></code> object is <em>not</em> associated with a <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-24">drag data store</a>, the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-8">DataTransferItemList</a></code> object’s <i>mode</i> is the <i>disabled mode</i>. The <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-25">drag data store</a> referenced in this
  section (which is used only when the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-9">DataTransferItemList</a></code> object is not in the <i>disabled mode</i>) is the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-26">drag data store</a> with which the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-10">DataTransferItemList</a></code> object’s <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-17">DataTransfer</a></code> object is associated.</p>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransferItemList" data-dfn-type="attribute" data-export="" id="dom-datatransferitemlist-length"><code>length</code></dfn> attribute must
  return zero if the object is in the <i>disabled mode</i>; otherwise it must return the number of
  items in the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-12">drag data store item list</a>.</p>
     <p>When a <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-11">DataTransferItemList</a></code> object is not in the <i>disabled mode</i>, its <a data-link-type="dfn" href="https://www.w3.org/TR/WebIDL-1/#dfn-supported-property-indices">supported property indices</a> are the numbers in the range 0 .. <var>n</var>-1, where <var>n</var> is the number of items in the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-13">drag data store item list</a>.</p>
     <p>To <a data-link-type="dfn" href="https://www.w3.org/TR/WebIDL-1/#dfn-determine-the-value-of-an-indexed-property">determine the value of an indexed property</a> <var>i</var> of a <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-12">DataTransferItemList</a></code> object, the user agent must return a <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-5">DataTransferItem</a></code> object representing the <var>i</var>th item in the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-27">drag data store</a>. The same object must be returned each time a particular item is
  obtained from this <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-13">DataTransferItemList</a></code> object. The <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-6">DataTransferItem</a></code> object must be associated with the same <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-18">DataTransfer</a></code> object as the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-14">DataTransferItemList</a></code> object when it is first created.</p>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransferItemList" data-dfn-type="method" data-export="" data-lt="add()|add(data)|add(data, type)" id="dom-datatransferitemlist-add"><code>add()</code></dfn> method must run the
  following steps:</p>
     <ol>
      <li>If the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-15">DataTransferItemList</a></code> object is not in the <i>read/write mode</i>, return null and abort these steps.
      </li><li>
       <p>Jump to the appropriate set of steps from the following list:</p>
       <dl class="switch">
        <dt>If the first argument to the method is a string
        </dt><dd>
         <p>If there is already an item in the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-14">drag data store item list</a> whose <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-10">kind</a></code> is <i>Plain Unicode string</i> and whose <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-8">type string</a> is equal to the value of the
      method’s second argument, <a data-link-type="dfn" href="https://www.w3.org/TR/dom/#converted-to-ascii-lowercase">converted to ASCII lowercase</a>, then throw a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notsupportederror">NotSupportedError</a></code> exception and abort these steps.</p>
         <p>Otherwise, add an item to the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-15">drag data store item list</a> whose <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-11">kind</a></code> is <i>Plain Unicode string</i>, whose <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-9">type string</a> is equal to the value of the method’s second
      argument, <a data-link-type="dfn" href="https://www.w3.org/TR/dom/#converted-to-ascii-lowercase">converted to ASCII lowercase</a>, and whose data is the string given by the
      method’s first argument.</p>
        </dd><dt>If the first argument to the method is a <code>File</code>
        </dt><dd>
         <p>Add an item to the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-16">drag data store item list</a> whose <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-12">kind</a></code> is <i>File</i>, whose <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-10">type
      string</a> is the <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-type" id="ref-for-dom-datatransferitem-type-1">type</a></code> of the <code>File</code>, <a data-link-type="dfn" href="https://www.w3.org/TR/dom/#converted-to-ascii-lowercase">converted to ASCII lowercase</a>, and whose data is the same as the <code>File</code>’s data.</p>
       </dd></dl>
      </li><li><a data-link-type="dfn" href="https://www.w3.org/TR/WebIDL-1/#dfn-determine-the-value-of-an-indexed-property">Determine the value of the indexed property</a> corresponding to the newly added item, and return that value (a newly created <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-7">DataTransferItem</a></code> object).
     </li></ol>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransferItemList" data-dfn-type="method" data-export="" data-lt="remove(index)" id="dom-datatransferitemlist-remove"><code>remove()</code></dfn> method, when
  invoked with the argument <var>i</var>, must run these steps:</p>
     <ol>
      <li>If the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-16">DataTransferItemList</a></code> object is not in the <i>read/write mode</i>, throw an <code>InvalidStateError</code> exception and
    abort these steps.
      </li><li>Remove the <var>i</var>th item from the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-28">drag data store</a>.
     </li></ol>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransferItemList" data-dfn-type="method" data-export="" id="dom-datatransferitemlist-clear"><code>clear()</code></dfn> method, if the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitemlist-datatransferitemlist" id="ref-for-datatransferitemlist-datatransferitemlist-17">DataTransferItemList</a></code> object is in the <i>read/write mode</i>,
  must remove all the items from the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-29">drag data store</a>. Otherwise, it must do
  nothing.</p>
    </div>
    <h5 class="heading settled" data-level="5.7.3.2" id="the-datatransferitem-interface"><span class="secno">5.7.3.2. </span><span class="content">The <code>DataTransferItem</code> interface</span><a class="self-link" href="editing.html#the-datatransferitem-interface"></a></h5>
    <p>Each <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-8">DataTransferItem</a></code> object is associated with a <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-19">DataTransfer</a></code> object.</p>
<pre class="idl highlight def" data-highlight="webidl"><span class="kt">interface</span> <dfn class="nv dfn-paneled idl-code" data-dfn-for="DataTransferItem" data-dfn-type="interface" data-export="" id="datatransferitem-datatransferitem">DataTransferItem</dfn> {
  <span class="kt">readonly</span> <span class="kt">attribute</span> <span class="kt">DOMString</span> <a class="nv idl-code" data-link-type="attribute" data-readonly="" data-type="DOMString" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-13">kind</a>;
  <span class="kt">readonly</span> <span class="kt">attribute</span> <span class="kt">DOMString</span> <a class="nv idl-code" data-link-type="attribute" data-readonly="" data-type="DOMString" href="editing.html#dom-datatransferitem-type" id="ref-for-dom-datatransferitem-type-2">type</a>;
  <span class="kt">void</span> <a class="nv idl-code" data-link-type="method" href="editing.html#dom-datatransferitem-getasstring" id="ref-for-dom-datatransferitem-getasstring-1">getAsString</a>(<a class="n" data-link-type="idl-name" href="editing.html#callbackdef-datatransferitem-functionstringcallback" id="ref-for-callbackdef-datatransferitem-functionstringcallback-1">FunctionStringCallback</a>? <dfn class="nv idl-code" data-dfn-for="DataTransferItem/getAsString(_callback)" data-dfn-type="argument" data-export="" id="dom-datatransferitem-getasstring-_callback-_callback">_callback<a class="self-link" href="editing.html#dom-datatransferitem-getasstring-_callback-_callback"></a></dfn>);
  <a class="n" data-link-type="idl-name" href="https://www.w3.org/TR/FileAPI/#dfn-file">File</a>? <a class="nv idl-code" data-link-type="method" href="editing.html#dom-datatransferitem-getasfile" id="ref-for-dom-datatransferitem-getasfile-1">getAsFile</a>();
};

<span class="kt">callback</span> <dfn class="nv dfn-paneled idl-code" data-dfn-for="DataTransferItem" data-dfn-type="callback" data-export="" id="callbackdef-datatransferitem-functionstringcallback">FunctionStringCallback</dfn> = <span class="kt">void</span> (<span class="kt">DOMString</span> <dfn class="nv idl-code" data-dfn-for="FunctionStringCallback" data-dfn-type="argument" data-export="" id="dom-functionstringcallback-data">data<a class="self-link" href="editing.html#dom-functionstringcallback-data"></a></dfn>);
</pre>
    <dl class="domintro">
     <dt><var>item</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-kind" id="ref-for-dom-datatransferitem-kind-14">kind</a></code>
     </dt><dd>
      <p>Returns <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-2">the drag data item kind</a>, one of: "string",
      "file".</p>
     </dd><dt><var>item</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-type" id="ref-for-dom-datatransferitem-type-3">type</a></code>
     </dt><dd>
      <p>Returns <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-11">the drag data item type string</a>.</p>
     </dd><dt><var>item</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-getasstring" id="ref-for-dom-datatransferitem-getasstring-2">getAsString</a></code>(<var>callback</var>)
     </dt><dd>
      <p>Invokes the callback with the string data as the argument, if <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-3">the drag data item
    kind</a> is <i>Plain Unicode string</i>.</p>
     </dd><dt><var>file</var> = <var>item</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransferitem-getasfile" id="ref-for-dom-datatransferitem-getasfile-2">getAsFile()</a></code>
     </dt><dd>
      <p>Returns a <code>File</code> object, if <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-4">the drag data item kind</a> is <i>File</i>.</p>
    </dd></dl>
    <div class="impl">
     <p>While the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-9">DataTransferItem</a></code> object’s <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-20">DataTransfer</a></code> object is associated
  with a <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-30">drag data store</a> and that <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-31">drag data store</a>’s <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-17">drag data store
  item list</a> still contains the item that the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-10">DataTransferItem</a></code> object represents,
  the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-11">DataTransferItem</a></code> object’s <i>mode</i> is the same as the <a data-link-type="dfn" href="editing.html#drag-data-store-mode" id="ref-for-drag-data-store-mode-3">drag data store
  mode</a>. When the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-12">DataTransferItem</a></code> object’s <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-21">DataTransfer</a></code> object is <em>not</em> associated with a <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-32">drag data store</a>, or if the item that the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-13">DataTransferItem</a></code> object represents has been removed from the relevant <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-18">drag data
  store item list</a>, the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-14">DataTransferItem</a></code> object’s <i>mode</i> is the <i>disabled
  mode</i>. The <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-33">drag data store</a> referenced in this section (which is used only when the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-15">DataTransferItem</a></code> object is not in the <i>disabled mode</i>) is the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-34">drag data
  store</a> with which the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-16">DataTransferItem</a></code> object’s <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-22">DataTransfer</a></code> object is associated.</p>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransferItem" data-dfn-type="attribute" data-export="" id="dom-datatransferitem-kind"><code>kind</code></dfn> attribute must return the
  empty string if the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-17">DataTransferItem</a></code> object is in the <i>disabled mode</i>; otherwise
  it must return the string given in the cell from the second column of the following table from the
  row whose cell in the first column contains <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-5">the drag data item kind</a> of the item
  represented by the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-18">DataTransferItem</a></code> object:</p>
     <table>
      <thead>
       <tr>
        <th> Kind 
        </th><th> String 
      </th></tr></thead><tbody>
       <tr>
        <td> <i>Plain Unicode string</i> 
        </td><td> "<code>string</code>" 
       </td></tr><tr>
        <td> <i>File</i> 
        </td><td> "<code>file</code>" 
     </td></tr></tbody></table>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransferItem" data-dfn-type="attribute" data-export="" id="dom-datatransferitem-type"><code>type</code></dfn> attribute must return the
  empty string if the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-19">DataTransferItem</a></code> object is in the <i>disabled mode</i>; otherwise
  it must return <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-12">the drag data item type string</a> of the item represented by the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-20">DataTransferItem</a></code> object.</p>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransferItem" data-dfn-type="method" data-export="" data-lt="getAsString(_callback)" id="dom-datatransferitem-getasstring"><code>getAsString(<var>callback</var>)</code></dfn> method must run the following steps:</p>
     <ol>
      <li>If the <var>callback</var> is null, abort these steps.
      </li><li>If the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-21">DataTransferItem</a></code> object is not in the <i>read/write mode</i> or the <i>read-only mode</i>,
    abort these steps. The callback is never invoked.
      </li><li>If <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-6">the drag data item kind</a> is not <i>Plain Unicode string</i>, abort these
    steps. The callback is never invoked.
      </li><li>Otherwise, <a data-link-type="dfn" href="webappapis.html#queuing" id="ref-for-queuing-114">queue a task</a> to invoke <var>callback</var>, passing the
    actual data of the item represented by the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-22">DataTransferItem</a></code> object as the
    argument.
     </li></ol>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DataTransferItem" data-dfn-type="method" data-export="" id="dom-datatransferitem-getasfile"><code>getAsFile()</code></dfn> method must run the following steps:</p>
     <ol>
      <li>If the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-23">DataTransferItem</a></code> object is not in the <i>read/write mode</i> or the <i>read-only mode</i>,
    return null and abort these steps.
      </li><li>If <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-7">the drag data item kind</a> is not <i>File</i>, then return null and abort
    these steps.
      </li><li>Return a new <code>File</code> object representing the actual data of the item represented
    by the <code class="idl"><a data-link-type="idl" href="editing.html#datatransferitem-datatransferitem" id="ref-for-datatransferitem-datatransferitem-24">DataTransferItem</a></code> object. 
     </li></ol>
    </div>
    <h4 class="heading settled" data-level="5.7.4" id="the-dragevent-interface"><span class="secno">5.7.4. </span><span class="content">The <code>DragEvent</code> interface</span><a class="self-link" href="editing.html#the-dragevent-interface"></a></h4>
    <p>The drag-and-drop processing model involves several events. They all use the <code class="idl"><a data-link-type="idl" href="editing.html#dragevent-dragevent" id="ref-for-dragevent-dragevent-1">DragEvent</a></code> interface.</p>
<pre class="idl highlight def" data-highlight="webidl">[<dfn class="nv idl-code" data-dfn-for="DragEvent" data-dfn-type="constructor" data-export="" data-lt="DragEvent(type, eventInitDict)|DragEvent(type)" id="dom-dragevent-dragevent">Constructor<a class="self-link" href="editing.html#dom-dragevent-dragevent"></a></dfn>(<span class="kt">DOMString</span> <dfn class="nv idl-code" data-dfn-for="DragEvent/DragEvent(type, eventInitDict)" data-dfn-type="argument" data-export="" id="dom-dragevent-dragevent-type-eventinitdict-type">type<a class="self-link" href="editing.html#dom-dragevent-dragevent-type-eventinitdict-type"></a></dfn>, <span class="kt">optional</span> <a class="n" data-link-type="idl-name" href="editing.html#dictdef-dragevent-drageventinit" id="ref-for-dictdef-dragevent-drageventinit-1">DragEventInit</a> <dfn class="nv idl-code" data-dfn-for="DragEvent/DragEvent(type, eventInitDict)" data-dfn-type="argument" data-export="" id="dom-dragevent-dragevent-type-eventinitdict-eventinitdict">eventInitDict<a class="self-link" href="editing.html#dom-dragevent-dragevent-type-eventinitdict-eventinitdict"></a></dfn>)]
<span class="kt">interface</span> <dfn class="nv dfn-paneled idl-code" data-dfn-for="DragEvent" data-dfn-type="interface" data-export="" id="dragevent-dragevent">DragEvent</dfn> : <a class="n" data-link-type="idl-name" href="https://www.w3.org/TR/uievents/#interface-MouseEvent">MouseEvent</a> {
  <span class="kt">readonly</span> <span class="kt">attribute</span> <a class="n" data-link-type="idl-name" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-23">DataTransfer</a>? <a class="nv idl-code" data-link-type="attribute" data-readonly="" data-type="DataTransfer?" href="editing.html#dom-dragevent-datatransfer" id="ref-for-dom-dragevent-datatransfer-1">dataTransfer</a>;
};

<span class="kt">dictionary</span> <dfn class="nv dfn-paneled idl-code" data-dfn-for="DragEvent" data-dfn-type="dictionary" data-export="" id="dictdef-dragevent-drageventinit">DragEventInit</dfn> : <a class="n" data-link-type="idl-name" href="https://www.w3.org/TR/uievents/#idl-def-MouseEventInit">MouseEventInit</a> {
  <a class="n" data-link-type="idl-name" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-24">DataTransfer</a>? <dfn class="nv idl-code" data-default="null" data-dfn-for="DragEventInit" data-dfn-type="dict-member" data-export="" data-type="DataTransfer? " id="dom-drageventinit-datatransfer">dataTransfer<a class="self-link" href="editing.html#dom-drageventinit-datatransfer"></a></dfn> = <span class="kt">null</span>;
};
</pre>
    <dl class="domintro">
     <dt><var>event</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-dragevent-datatransfer" id="ref-for-dom-dragevent-datatransfer-2">dataTransfer</a></code>
     </dt><dd>
      <p>Returns the <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-25">DataTransfer</a></code> object for the event.</p>
    </dd></dl>
    <p class="note" role="note"> Although, for consistency with other event interfaces, the <code class="idl"><a data-link-type="idl" href="editing.html#dragevent-dragevent" id="ref-for-dragevent-dragevent-2">DragEvent</a></code> interface has a constructor, it is not particularly useful. In particular, there’s no way to
  create a useful <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-26">DataTransfer</a></code> object from script, as <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-27">DataTransfer</a></code> objects
  have a processing and security model that is coordinated by the browser during drag-and-drops. </p>
    <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="DragEvent" data-dfn-type="attribute" data-export="" id="dom-dragevent-datatransfer"><code>dataTransfer</code></dfn> attribute of the <code class="idl"><a data-link-type="idl" href="editing.html#dragevent-dragevent" id="ref-for-dragevent-dragevent-3">DragEvent</a></code> interface must return the value it was initialized to. It represents the
  context information for the event.</p>
    <p>When a user agent is required to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="fire-a-dnd-event">fire a DND event</dfn> named <var>e</var> at an element,
  using a particular <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-35">drag data store</a>, and optionally with a specific <var>related
  target</var>, the user agent must run the following steps:</p>
    <ol>
     <li>If no specific <var>related target</var> was provided, set <var>related target</var> to
    null.
     </li><li>Let <var>window</var> be the <code>Window</code> object of the <code>Document</code> object of the specified target element.
     </li><li>
      <p>If <var>e</var> is <code>dragstart</code>, set the <a data-link-type="dfn" href="editing.html#drag-data-store-mode" id="ref-for-drag-data-store-mode-4">drag
    data store mode</a> to the <a data-link-type="dfn" href="editing.html#read-write-mode" id="ref-for-read-write-mode-5">read/write mode</a>.</p>
      <p>If <var>e</var> is <code>drop</code>, set the <a data-link-type="dfn" href="editing.html#drag-data-store-mode" id="ref-for-drag-data-store-mode-5">drag data store
    mode</a> to the <a data-link-type="dfn" href="editing.html#read-only-mode" id="ref-for-read-only-mode-1">read-only mode</a>.</p>
     </li><li>Let <var>dataTransfer</var> be a newly created <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-28">DataTransfer</a></code> object
    associated with the given <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-36">drag data store</a>.
     </li><li>Set the <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-effectallowed" id="ref-for-dom-datatransfer-effectallowed-5">effectAllowed</a></code> attribute to the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-37">drag data
    store</a>’s <a data-link-type="dfn" href="editing.html#drag-data-store-allowed-effects-state" id="ref-for-drag-data-store-allowed-effects-state-2">drag data store allowed effects state</a>.
     </li><li>
      <p>Set the <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-dropeffect" id="ref-for-dom-datatransfer-dropeffect-6">dropEffect</a></code> attribute to "<code>none</code>" if <var>e</var> is <code>dragstart</code>, <code>drag</code>, <code>dragexit</code>, or <code>dragleave</code>; to the value corresponding to the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-1">current
    drag operation</a> if <var>e</var> is <code>drop</code> or <code>dragend</code>; and to a value based on the <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-effectallowed" id="ref-for-dom-datatransfer-effectallowed-6">effectAllowed</a></code> attribute’s value and the
    drag-and-drop source, as given by the following table, otherwise (i.e., if <var>e</var> is <code>dragenter</code> or <code>dragover</code>):</p>
      <table>
       <thead>
        <tr>
         <th><code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-effectallowed" id="ref-for-dom-datatransfer-effectallowed-7">effectAllowed</a></code>
         </th><th><code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-dropeffect" id="ref-for-dom-datatransfer-dropeffect-7">dropEffect</a></code>
       </th></tr></thead><tbody>
        <tr>
         <td>"<code>none</code>"
         </td><td>"<code>none</code>"
        </td></tr><tr>
         <td>"<code>copy</code>"
         </td><td>"<code>copy</code>"
        </td></tr><tr>
         <td>"<code>copyLink</code>"
         </td><td>"<code>copy</code>", or, <a data-link-type="dfn" href="editing.html#if-appropriate" id="ref-for-if-appropriate-1">if appropriate</a>, "<code>link</code>"
        </td></tr><tr>
         <td>"<code>copyMove</code>"
         </td><td>"<code>copy</code>", or, <a data-link-type="dfn" href="editing.html#if-appropriate" id="ref-for-if-appropriate-2">if appropriate</a>, "<code>move</code>"
        </td></tr><tr>
         <td>"<code>all</code>"
         </td><td>"<code>copy</code>", or, <a data-link-type="dfn" href="editing.html#if-appropriate" id="ref-for-if-appropriate-3">if appropriate</a>, either "<code>link</code>" or "<code>move</code>"
        </td></tr><tr>
         <td>"<code>link</code>"
         </td><td>"<code>link</code>"
        </td></tr><tr>
         <td>"<code>linkMove</code>"
         </td><td>"<code>link</code>", or, <a data-link-type="dfn" href="editing.html#if-appropriate" id="ref-for-if-appropriate-4">if appropriate</a>, "<code>move</code>"
        </td></tr><tr>
         <td>"<code>move</code>"
         </td><td>"<code>move</code>"
        </td></tr><tr>
         <td>"<code>uninitialized</code>" when what is being dragged is a selection from a text field
         </td><td>"<code>move</code>", or, <a data-link-type="dfn" href="editing.html#if-appropriate" id="ref-for-if-appropriate-5">if appropriate</a>, either "<code>copy</code>" or "<code>link</code>"
        </td></tr><tr>
         <td>"<code>uninitialized</code>" when what is being dragged is a selection
         </td><td>"<code>copy</code>", or, <a data-link-type="dfn" href="editing.html#if-appropriate" id="ref-for-if-appropriate-6">if appropriate</a>, either "<code>link</code>" or "<code>move</code>"
        </td></tr><tr>
         <td>"<code>uninitialized</code>" when what is being dragged is an <code><a data-link-type="element" href="textlevel-semantics.html#elementdef-a" id="ref-for-elementdef-a-90">a</a></code> element with an <code><a data-link-type="element-sub" href="links.html#element-attrdef-a-href" id="ref-for-element-attrdef-a-href-32">href</a></code> attribute
         </td><td>"<code>link</code>", or, <a data-link-type="dfn" href="editing.html#if-appropriate" id="ref-for-if-appropriate-7">if appropriate</a>, either "<code>copy</code>" or "<code>move</code>"
        </td></tr><tr>
         <td>Any other case
         </td><td>"<code>copy</code>", or, <a data-link-type="dfn" href="editing.html#if-appropriate" id="ref-for-if-appropriate-8">if appropriate</a>, either "<code>link</code>" or "<code>move</code>"
      </td></tr></tbody></table>
      <p>Where the table above provides <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="if appropriate|possibly appropriate alternatives" data-noexport="" id="if-appropriate">possibly appropriate alternatives</dfn>, user agents may instead use the listed alternative values if
    platform conventions dictate that the user has requested those alternate effects.</p>
      <p class="example" id="example-8cbdfd52"><a class="self-link" href="editing.html#example-8cbdfd52"></a> For example, Windows platform conventions are such that dragging while
    holding the "alt" key indicates a preference for linking the data, rather than moving or copying
    it. Therefore, on a Windows system, if "<code>link</code>" is an option according to
    the table above while the "alt" key is depressed, the user agent could select that instead of
    "<code>copy</code>" or "<code>move</code>". </p>
     </li><li>
      <p>Create a <a data-link-type="dfn" href="infrastructure.html#trusted" id="ref-for-trusted-14">trusted</a> <code class="idl"><a data-link-type="idl" href="editing.html#dragevent-dragevent" id="ref-for-dragevent-dragevent-4">DragEvent</a></code> object
    and initialize it to have the given name <var>e</var>, to bubble, to be cancelable unless <var>e</var> is <code>dragexit</code>, <code>dragleave</code>, or <code>dragend</code>, and to have the <code>view</code> attribute initialized to <var>window</var>, the <code>detail</code> attribute initialized to zero, the mouse and key
    attributes initialized according to the state of the input devices as they would be for user
    interaction events, the <code>relatedTarget</code> attribute initialized to <var>related target</var>, and the <code class="idl"><a data-link-type="idl" href="editing.html#dom-dragevent-datatransfer" id="ref-for-dom-dragevent-datatransfer-3">dataTransfer</a></code> attribute initialized to <var>dataTransfer</var>, the <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-29">DataTransfer</a></code> object created above.</p>
      <p>If there is no relevant pointing device, the object must have its <code>screenX</code>, <code>screenY</code>, <code>clientX</code>, <code>clientY</code>, and <code>button</code> attributes set to 0.</p>
     </li><li><a data-link-type="dfn" href="infrastructure.html#dispatch" id="ref-for-dispatch-4">Dispatch</a> the newly created <code class="idl"><a data-link-type="idl" href="editing.html#dragevent-dragevent" id="ref-for-dragevent-dragevent-5">DragEvent</a></code> object at the specified target element.
     </li><li>Set the <a data-link-type="dfn" href="editing.html#drag-data-store-allowed-effects-state" id="ref-for-drag-data-store-allowed-effects-state-3">drag data store allowed effects state</a> to the current value of <var>dataTransfer</var>’s <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-effectallowed" id="ref-for-dom-datatransfer-effectallowed-8">effectAllowed</a></code> attribute. (It can only have changed value if <var>e</var> is <code>dragstart</code>.)
     </li><li>Set the <a data-link-type="dfn" href="editing.html#drag-data-store-mode" id="ref-for-drag-data-store-mode-6">drag data store mode</a> back to the <a data-link-type="dfn" href="editing.html#protected-mode" id="ref-for-protected-mode-4">protected mode</a> if it was changed in the first step.
     </li><li>Break the association between <var>dataTransfer</var> and the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-38">drag data
    store</a>.
    </li></ol>
    <div class="impl">
     <h4 class="heading settled" data-level="5.7.5" id="drag-and-drop-processing-model"><span class="secno">5.7.5. </span><span class="content">Drag-and-drop processing model</span><a class="self-link" href="editing.html#drag-and-drop-processing-model"></a></h4>
     <p>When the user attempts to begin a drag operation, the user agent must run the following steps.
  User agents must act as if these steps were run even if the drag actually started in another
  document or application and the user agent was not aware that the drag was occurring until it
  intersected with a document under the user agent’s purview.</p>
     <ol>
      <li>
       <p>Determine what is being dragged, as follows:</p>
       <p>If the drag operation was invoked on a selection, then it is the selection that is being
    dragged.</p>
       <p>Otherwise, if the drag operation was invoked on a <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/dom/#document">Document</a></code>, it is the first
    element, going up the ancestor chain, starting at the node that the user tried to drag, that has
    the IDL attribute <code class="idl"><a data-link-type="idl" href="editing.html#dom-htmlelement-draggable" id="ref-for-dom-htmlelement-draggable-2">draggable</a></code> set to true. If there is no such
    element, then nothing is being dragged; abort these steps, the drag-and-drop operation is never
    started.</p>
       <p>Otherwise, the drag operation was invoked outside the user agent’s purview. What is being
    dragged is defined by the document or application where the drag was started.</p>
       <p class="note" role="note"> <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-img" id="ref-for-elementdef-img-148">img</a></code> elements and <code><a data-link-type="element" href="textlevel-semantics.html#elementdef-a" id="ref-for-elementdef-a-91">a</a></code> elements with an <code><a data-link-type="element-sub" href="links.html#element-attrdef-a-href" id="ref-for-element-attrdef-a-href-33">href</a></code> attribute have their <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-draggable" id="ref-for-element-attrdef-global-draggable-4">draggable</a></code> attribute set to true by default. </p>
      </li><li><a data-link-type="dfn" href="editing.html#create-a-drag-data-store" id="ref-for-create-a-drag-data-store-1">Create a drag data store</a>. All the DND events fired subsequently by the steps
    in this section must use this <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-39">drag data store</a>.
      </li><li>
       <p>Establish which DOM node is the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="source-node">source node</dfn>, as follows:</p>
       <p>If it is a selection that is being dragged, then the <a data-link-type="dfn" href="editing.html#source-node" id="ref-for-source-node-1">source node</a> is the <code>Text</code> node that the user started the drag on (typically the <code>Text</code> node
    that the user originally clicked). If the user did not specify a particular node, for example if
    the user just told the user agent to begin a drag of "the selection", then the <a data-link-type="dfn" href="editing.html#source-node" id="ref-for-source-node-2">source
    node</a> is the first <code>Text</code> node containing a part of the selection.</p>
       <p>Otherwise, if it is an element that is being dragged, then the <a data-link-type="dfn" href="editing.html#source-node" id="ref-for-source-node-3">source node</a> is
    the element that is being dragged.</p>
       <p>Otherwise, the <a data-link-type="dfn" href="editing.html#source-node" id="ref-for-source-node-4">source node</a> is part of another document or application. When this
    specification requires that an event be dispatched at the <a data-link-type="dfn" href="editing.html#source-node" id="ref-for-source-node-5">source node</a> in this case,
    the user agent must instead follow the platform-specific conventions relevant to that
    situation.</p>
       <p class="note" role="note"> Multiple events are fired on the <a data-link-type="dfn" href="editing.html#source-node" id="ref-for-source-node-6">source node</a> during the course of the drag-and-drop
      operation. </p>
      </li><li>
       <p>Determine the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="list-of-dragged-nodes">list of dragged nodes</dfn>, as follows:</p>
       <p>If it is a selection that is being dragged, then the <a data-link-type="dfn" href="editing.html#list-of-dragged-nodes" id="ref-for-list-of-dragged-nodes-1">list of dragged nodes</a> contains, in <a data-link-type="dfn" href="infrastructure.html#tree-order" id="ref-for-tree-order-72">tree order</a>, every node that is partially or completely included in the
    selection (including all their ancestors).</p>
       <p>Otherwise, the <a data-link-type="dfn" href="editing.html#list-of-dragged-nodes" id="ref-for-list-of-dragged-nodes-2">list of dragged nodes</a> contains only the <a data-link-type="dfn" href="editing.html#source-node" id="ref-for-source-node-7">source node</a>,
    if any.</p>
      </li><li>
       <p>If it is a selection that is being dragged, then add an item to the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-19">drag data store
    item list</a>, with its properties set as follows:</p>
       <dl>
        <dt><a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-13">The drag data item type string</a> 
        </dt><dd>"<code>text/plain</code>"
        </dd><dt><a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-8">The drag data item kind</a> 
        </dt><dd><i>Plain Unicode string</i>
        </dd><dt>The actual data
        </dt><dd>The text of the selection
       </dd></dl>
       <p>Otherwise, if any files are being dragged, then add one item per file to the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-20">drag data
    store item list</a>, with their properties set as follows:</p>
       <dl>
        <dt><a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-14">The drag data item type string</a> 
        </dt><dd>The MIME type of the file, if known, or "<code>application/octet-stream</code>" otherwise.
        </dd><dt><a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-9">The drag data item kind</a> 
        </dt><dd><i>File</i>
        </dd><dt>The actual data
        </dt><dd>The file’s contents and name.
       </dd></dl>
       <p class="note" role="note"> Dragging files can currently only happen from outside a <a data-link-type="dfn" href="browsers.html#browsing-context" id="ref-for-browsing-context-92">browsing
    context</a>, for example from a file system manager application. </p>
       <p>If the drag initiated outside of the application, the user agent must add items to the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-21">drag data store item list</a> as appropriate for the data being dragged, honoring
    platform conventions where appropriate; however, if the platform conventions do not use <a data-link-type="dfn" href="infrastructure.html#mime-type" id="ref-for-mime-type-33">MIME types</a> to label dragged data, the user agent must make a
    best-effort attempt to map the types to MIME types, and, in any case, all the <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-15">drag data item type strings</a> must be <a data-link-type="dfn" href="https://www.w3.org/TR/dom/#converted-to-ascii-lowercase">converted to ASCII
    lowercase</a>.</p>
       <p>User agents may also add one or more items representing the selection or dragged element(s)
    in other forms, e.g., as HTML.</p>
      </li><li>
       <p>If the <a data-link-type="dfn" href="editing.html#list-of-dragged-nodes" id="ref-for-list-of-dragged-nodes-3">list of dragged nodes</a> is not empty, then extract the microdata from those nodes into a JSON form, and add one item to the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-22">drag data store item list</a>, with its properties set as follows:</p>
       <dl>
        <dt><a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-16">The drag data item type string</a> 
        </dt><dd><code>application/microdata+json</code>
        </dd><dt><a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-10">The drag data item kind</a> 
        </dt><dd><i>Plain Unicode string</i>
        </dd><dt>The actual data
        </dt><dd>The resulting JSON string.
       </dd></dl>
      </li><li>
       <p>Run the following substeps:</p>
       <ol>
        <li>Let <var>urls</var> be an empty list of <a data-link-type="dfn" href="https://url.spec.whatwg.org/#syntax-url-absolute">absolute URLs</a>.
        </li><li>
         <p>For each <var>node</var> in the <a data-link-type="dfn" href="editing.html#list-of-dragged-nodes" id="ref-for-list-of-dragged-nodes-4">list of dragged nodes</a>:</p>
         <dl>
          <dt>If the node is an <code><a data-link-type="element" href="textlevel-semantics.html#elementdef-a" id="ref-for-elementdef-a-92">a</a></code> element with an <code><a data-link-type="element-sub" href="links.html#element-attrdef-a-href" id="ref-for-element-attrdef-a-href-34">href</a></code> attribute
          </dt><dd>Add to <var>urls</var> the result of <a data-link-type="dfn" href="infrastructure.html#reparsed" id="ref-for-reparsed-33">parsing</a> the element’s <code><a data-link-type="element-sub" href="links.html#element-attrdef-a-href" id="ref-for-element-attrdef-a-href-35">href</a></code> content
        attribute relative to the element.
          </dd><dt>If the node is an <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-img" id="ref-for-elementdef-img-149">img</a></code> element with a <code><a data-link-type="element-sub" href="semantics-embedded-content.html#element-attrdef-img-src" id="ref-for-element-attrdef-img-src-3">src</a></code> attribute
          </dt><dd>Add to <var>urls</var> the result of <a data-link-type="dfn" href="infrastructure.html#reparsed" id="ref-for-reparsed-34">parsing</a> the element’s <code>src</code> content attribute
        relative to the element.
         </dd></dl>
        </li><li>If <var>urls</var> is still empty, abort these substeps.
        </li><li>Let <var>url string</var> be the result of concatenating the strings in <var>urls</var>,
      in the order they were added, separated by a U+000D CARRIAGE RETURN U+000A LINE FEED character
      pair (CRLF).
        </li><li>
         Add one item to the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-23">drag data store item list</a>, with its properties set as
      follows: 
         <dl>
          <dt><a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-17">The drag data item type string</a> 
          </dt><dd><code>text/uri-list</code>
          </dd><dt><a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-11">The drag data item kind</a> 
          </dt><dd><i>Plain Unicode string</i>
          </dd><dt>The actual data
          </dt><dd><var>url string</var>
         </dd></dl>
       </li></ol>
      </li><li>
       <p>Update the <a data-link-type="dfn" href="editing.html#drag-data-store-default-feedback" id="ref-for-drag-data-store-default-feedback-2">drag data store default feedback</a> as appropriate for the user agent
    (if the user is dragging the selection, then the selection would likely be the basis for this
    feedback; if the user is dragging an element, then that element’s rendering would be used; if
    the drag began outside the user agent, then the platform conventions for determining the drag
    feedback should be used).</p>
      </li><li>
       <p><a data-link-type="dfn" href="editing.html#fire-a-dnd-event" id="ref-for-fire-a-dnd-event-1">Fire a DND event</a> named <code>dragstart</code> at the <a data-link-type="dfn" href="editing.html#source-node" id="ref-for-source-node-8">source node</a>.</p>
       <p>If the event is canceled, then the drag-and-drop operation should not occur; abort these
    steps.</p>
       <p class="note" role="note"> Since events with no event listeners registered are, almost by definition, never
    canceled, drag-and-drop is always available to the user if the author does not specifically
    prevent it. </p>
      </li><li>
       <p><a data-link-type="dfn" href="editing.html#initiated" id="ref-for-initiated-1">Initiate the drag-and-drop operation</a> in a manner consistent with platform
    conventions, and as described below.</p>
       <p>The drag-and-drop feedback must be generated from the first of the
    following sources that is available:</p>
       <ol>
        <li>The <a data-link-type="dfn" href="editing.html#drag-data-store-bitmap" id="ref-for-drag-data-store-bitmap-4">drag data store bitmap</a>, if any. In this case, the <a data-link-type="dfn" href="editing.html#drag-data-store-hot-spot-coordinate" id="ref-for-drag-data-store-hot-spot-coordinate-3">drag data store
      hot spot coordinate</a> should be used as hints for where to put the cursor relative to the
      resulting image. The values are expressed as distances in CSS pixels from the left side and
      from the top side of the image respectively. <a data-link-type="biblio" href="references.html#biblio-css-2015">[CSS-2015]</a>
        </li><li>The <a data-link-type="dfn" href="editing.html#drag-data-store-default-feedback" id="ref-for-drag-data-store-default-feedback-3">drag data store default feedback</a>.
       </li></ol>
     </li></ol>
     <p>From the moment that the user agent is to <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="initiated|initiate the drag-and-drop operation" data-noexport="" id="initiated">initiate the drag-and-drop operation</dfn>,
  until the end of the drag-and-drop operation, device input events (e.g., mouse and keyboard events)
  must be suppressed.</p>
     <p>During the drag operation, the element directly indicated by the user as the drop target is
  called the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="immediate-user-selection">immediate user selection</dfn>. (Only elements can be selected by the user; other
  nodes must not be made available as drop targets.) However, the <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-1">immediate user
  selection</a> is not necessarily the <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="previous target element|current target element" data-noexport="" id="previous-target-element">current target element</dfn>, which is the element
  currently selected for the drop part of the drag-and-drop operation.</p>
     <p>The <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-2">immediate user selection</a> changes as the user selects different elements
  (either by pointing at them with a pointing device, or by selecting them in some other way). The <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-1">current target element</a> changes when the <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-3">immediate user selection</a> changes, based on the results of event listeners in the document, as described below.</p>
     <p>Both the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-2">current target element</a> and the <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-4">immediate user selection</a> can
  be null, which means no target element is selected. They can also both be elements in other
  (DOM-based) documents, or other (non-Web) programs altogether. (For example, a user could drag
  text to a word-processor.) The <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-3">current target element</a> is initially null.</p>
     <p>In addition, there is also a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="current-drag-operation">current drag operation</dfn>, which can take on the values
  "<dfn class="css" data-dfn-for="drag" data-dfn-type="value" data-export="" id="valdef-drag-none"><code>none</code><a class="self-link" href="editing.html#valdef-drag-none"></a></dfn>", "<dfn class="css" data-dfn-for="drag" data-dfn-type="value" data-export="" id="valdef-drag-copy"><code>copy</code><a class="self-link" href="editing.html#valdef-drag-copy"></a></dfn>", "<dfn class="css" data-dfn-for="drag" data-dfn-type="value" data-export="" id="valdef-drag-link"><code>link</code><a class="self-link" href="editing.html#valdef-drag-link"></a></dfn>", and "<dfn class="css" data-dfn-for="drag" data-dfn-type="value" data-export="" id="valdef-drag-move"><code>move</code><a class="self-link" href="editing.html#valdef-drag-move"></a></dfn>". Initially, it has the value
  "<code>none</code>". It is updated by the user agent
  as described in the steps below.</p>
     <p>User agents must, as soon as the drag operation is <a data-link-type="dfn" href="editing.html#initiated" id="ref-for-initiated-2">initiated</a> and every 350ms (±200ms) thereafter for as long as the drag
  operation is ongoing, <a data-link-type="dfn" href="webappapis.html#queuing" id="ref-for-queuing-115">queue a task</a> to perform the following steps in sequence:</p>
     <ol>
      <li>
       <p>If the user agent is still performing the previous iteration of the sequence (if any) when
    the next iteration becomes due, abort these steps for this iteration (effectively "skipping
    missed frames" of the drag-and-drop operation).</p>
      </li><li>
       <p><a data-link-type="dfn" href="editing.html#fire-a-dnd-event" id="ref-for-fire-a-dnd-event-2">Fire a DND event</a> named <code>drag</code> at the <a data-link-type="dfn" href="editing.html#source-node" id="ref-for-source-node-9">source node</a>. If this event is canceled, the user agent must set the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-2">current
    drag operation</a> to "<code>none</code>" (no
    drag operation).</p>
      </li><li>
       <p>If the <code>drag</code> event was not canceled and the user has not
    ended the drag-and-drop operation, check the state of the drag-and-drop operation, as
    follows:</p>
       <ol>
        <li>
         <p>If the user is indicating a different <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-5">immediate user selection</a> than during the
      last iteration (or if this is the first iteration), and if this <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-6">immediate user
      selection</a> is not the same as the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-4">current target element</a>, then <a data-link-type="dfn" href="editing.html#fire-a-dnd-event" id="ref-for-fire-a-dnd-event-3">fire a
      DND event</a> named <code>dragexit</code> at the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-5">current
      target element</a>, and then update the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-6">current target element</a> as follows:</p>
         <dl class="switch">
          <dt>If the new <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-7">immediate user selection</a> is null
          </dt><dd>Set the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-7">current target element</a> to null also.
          </dd><dt>If the new <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-8">immediate user selection</a> is in a non-DOM document or
        application
          </dt><dd>Set the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-8">current target element</a> to the <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-9">immediate user
        selection</a>.
          </dd><dt>Otherwise
          </dt><dd>
           <p><a data-link-type="dfn" href="editing.html#fire-a-dnd-event" id="ref-for-fire-a-dnd-event-4">Fire a DND event</a> named <code>dragenter</code> at the <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-10">immediate user selection</a>.</p>
           <p>If the event is canceled, then set the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-9">current target element</a> to the <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-11">immediate user selection</a>.</p>
           <p>Otherwise, run the appropriate step from the following list:</p>
           <dl class="switch">
            <dt>If the <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-12">immediate user selection</a> is a text field (e.g., <code><a data-link-type="element" href="sec-forms.html#elementdef-textarea" id="ref-for-elementdef-textarea-80">textarea</a></code>, or an <code><a data-link-type="element" href="sec-forms.html#elementdef-input" id="ref-for-elementdef-input-288">input</a></code> element whose <code><a data-link-type="element-sub" href="sec-forms.html#element-attrdef-input-type" id="ref-for-element-attrdef-input-type-141">type</a></code> attribute is in the <a data-link-type="dfn" href="dom.html#text" id="ref-for-text-16">Text</a> state) or an <a data-link-type="dfn" href="editing.html#editing-host" id="ref-for-editing-host-8">editing host</a> or <a data-link-type="dfn" href="editing.html#editable" id="ref-for-editable-6">editable</a> element, and the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-24">drag data store item list</a> has an item
          with <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-18">the drag data item type string</a> "<code>text/plain</code>" and <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-12">the
          drag data item kind</a> <i>Plain Unicode string</i>
            </dt><dd>Set the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-10">current target element</a> to the <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-13">immediate user
          selection</a> anyway.
            </dd><dt>If the <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-14">immediate user selection</a> is an element with a <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-6">dropzone</a></code> attribute that <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#match">matches</a> the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-40">drag data store</a>
            </dt><dd>Set the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-11">current target element</a> to the <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-15">immediate user
          selection</a> anyway.
            </dd><dt>If the <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-16">immediate user selection</a> is an element that itself has an ancestor
          element with a <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-7">dropzone</a></code> attribute that <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#match">matches</a> the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-41">drag data store</a>
            </dt><dd>
             <p>Let <var>new target</var> be the nearest (deepest) such ancestor element.</p>
             <p>If the <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-17">immediate user selection</a> is <var>new target</var>, then leave the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-12">current target element</a> unchanged.</p>
             <p>Otherwise, <a data-link-type="dfn" href="editing.html#fire-a-dnd-event" id="ref-for-fire-a-dnd-event-5">fire a DND event</a> named <code>dragenter</code> at <var>new target</var>, with the current <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-13">current target element</a> as the specific <var>related target</var>. Then, set
          the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-14">current target element</a> to <var>new target</var>, regardless of whether
          that event was canceled or not.</p>
            </dd><dt>If the <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-18">immediate user selection</a> is <a href="sections.html#the-body-element">the <code>body</code> element</a>
            </dt><dd>Leave the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-15">current target element</a> unchanged.
            </dd><dt>Otherwise
            </dt><dd>
             <p><a data-link-type="dfn" href="editing.html#fire-a-dnd-event" id="ref-for-fire-a-dnd-event-6">Fire a DND event</a> named <code>dragenter</code> at <a href="sections.html#the-body-element">the <code>body</code> element</a>, if there is one, or at the <code>Document</code> object,
          if not. Then, set the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-16">current target element</a> to <a href="sections.html#the-body-element">the <code>body</code> element</a>, regardless of whether that event was canceled or not.</p>
           </dd></dl>
         </dd></dl>
        </li><li>
         <p>If the previous step caused the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-17">current target element</a> to change, and if the
      previous target element was not null or a part of a non-DOM document, then <a data-link-type="dfn" href="editing.html#fire-a-dnd-event" id="ref-for-fire-a-dnd-event-7">fire a DND
      event</a> named <code>dragleave</code> at the previous target
      element, with the new <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-18">current target element</a> as the specific <var>related
      target</var>.</p>
        </li><li>
         <p>If the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-19">current target element</a> is a DOM element, then <a data-link-type="dfn" href="editing.html#fire-a-dnd-event" id="ref-for-fire-a-dnd-event-8">fire a DND
      event</a> named <code>dragover</code> at this <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-20">current
      target element</a>.</p>
         <p>If the <code>dragover</code> event is not canceled, run the
      appropriate step from the following list:</p>
         <dl class="switch">
          <dt>If the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-21">current target element</a> is a text field (e.g., <code><a data-link-type="element" href="sec-forms.html#elementdef-textarea" id="ref-for-elementdef-textarea-81">textarea</a></code>,
        or an <code><a data-link-type="element" href="sec-forms.html#elementdef-input" id="ref-for-elementdef-input-289">input</a></code> element whose <code><a data-link-type="element-sub" href="sec-forms.html#element-attrdef-input-type" id="ref-for-element-attrdef-input-type-142">type</a></code> attribute
        is in the <a data-link-type="dfn" href="dom.html#text" id="ref-for-text-17">Text</a> state) or an <a data-link-type="dfn" href="editing.html#editing-host" id="ref-for-editing-host-9">editing
        host</a> or <a data-link-type="dfn" href="editing.html#editable" id="ref-for-editable-7">editable</a> element, and the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-25">drag data store item list</a> has an item with <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-19">the drag data item type string</a> "<code>text/plain</code>" and <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-13">the drag data item kind</a> <i>Plain Unicode string</i>
          </dt><dd>Set the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-3">current drag operation</a> to either "<code>copy</code>" or "<code>move</code>", as appropriate given the platform
        conventions.
          </dd><dt>If the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-22">current target element</a> is an element with a <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-8">dropzone</a></code> attribute that <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#match">matches</a> the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-42">drag data store</a> and <a data-link-type="dfn" href="editing.html#specified" id="ref-for-specified-1">specifies an operation</a>
          </dt><dd>Set the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-4">current drag operation</a> to the operation <a data-link-type="dfn" href="editing.html#specified" id="ref-for-specified-2">specified</a> by the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-9">dropzone</a></code> attribute of the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-23">current target
        element</a>. 
          </dd><dt>If the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-24">current target element</a> is an element with a <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-10">dropzone</a></code> attribute that <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#match">matches</a> the <a data-link-type="dfn" href="editing.html#drag-data-store" id="ref-for-drag-data-store-43">drag data store</a> and does not <a data-link-type="dfn" href="editing.html#specified" id="ref-for-specified-3">specify an operation</a>
          </dt><dd>Set the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-5">current drag operation</a> to "<code>copy</code>". 
          </dd><dt>Otherwise
          </dt><dd>Reset the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-6">current drag operation</a> to "<code>none</code>".
         </dd></dl>
         <p>Otherwise (if the <code>dragover</code> event <em>is</em> canceled), set the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-7">current drag operation</a> based on the values of the <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-effectallowed" id="ref-for-dom-datatransfer-effectallowed-9">effectAllowed</a></code> and <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-dropeffect" id="ref-for-dom-datatransfer-dropeffect-8">dropEffect</a></code> attributes of the <code class="idl"><a data-link-type="idl" href="editing.html#dragevent-dragevent" id="ref-for-dragevent-dragevent-6">DragEvent</a></code> object’s <code class="idl"><a data-link-type="idl" href="editing.html#dom-dragevent-datatransfer" id="ref-for-dom-dragevent-datatransfer-4">dataTransfer</a></code> object as they stood after the event <a data-link-type="dfn" href="infrastructure.html#dispatch" id="ref-for-dispatch-5">dispatch</a> finished, as per the following table:</p>
         <table>
          <thead>
           <tr>
            <th><code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-effectallowed" id="ref-for-dom-datatransfer-effectallowed-10">effectAllowed</a></code>
            </th><th><code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-dropeffect" id="ref-for-dom-datatransfer-dropeffect-9">dropEffect</a></code>
            </th><th>Drag operation
          </th></tr></thead><tbody>
           <tr>
            <td>"<code>uninitialized</code>", "<code>copy</code>", "<code>copyLink</code>", "<code>copyMove</code>", or "<code>all</code>"
            </td><td>"<code>copy</code>"
            </td><td>"<code>copy</code>"
           </td></tr><tr>
            <td>"<code>uninitialized</code>", "<code>link</code>", "<code>copyLink</code>", "<code>linkMove</code>", or "<code>all</code>"
            </td><td>"<code>link</code>"
            </td><td>"<code>link</code>"
           </td></tr><tr>
            <td>"<code>uninitialized</code>", "<code>move</code>", "<code>copyMove</code>", "<code>linkMove</code>", or "<code>all</code>"
            </td><td>"<code>move</code>"
            </td><td>"<code>move</code>"
           </td></tr><tr>
            <td colspan="2">Any other case
            </td><td>"<code>none</code>"
         </td></tr></tbody></table>
        </li><li>
         <p>Otherwise, if the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-25">current target element</a> is not a DOM element, use
      platform-specific mechanisms to determine what drag operation is being performed (none, copy,
      link, or move), and set the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-8">current drag operation</a> accordingly.</p>
        </li><li>
         <p>Update the drag feedback (e.g., the mouse cursor) to match the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-9">current drag
      operation</a>, as follows:</p>
         <table>
          <thead>
           <tr>
            <th>Drag operation
            </th><th>Feedback
          </th></tr></thead><tbody>
           <tr>
            <td>"<code>copy</code>"
            </td><td>Data will be copied if dropped here.
           </td></tr><tr>
            <td>"<code>link</code>"
            </td><td>Data will be linked if dropped here.
           </td></tr><tr>
            <td>"<code>move</code>"
            </td><td>Data will be moved if dropped here.
           </td></tr><tr>
            <td>"<code>none</code>"
            </td><td>No operation allowed, dropping here will cancel the drag-and-drop operation.
         </td></tr></tbody></table>
       </li></ol>
      </li><li>
       <p>Otherwise, if the user ended the drag-and-drop operation (e.g., by releasing the mouse button
    in a mouse-driven drag-and-drop interface), or if the <code>drag</code> event was canceled, then this will be the last iteration. Run the following steps, then stop the
    drag-and-drop operation:</p>
       <ol>
        <li>
         <p>If the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-10">current drag operation</a> is "<code>none</code>" (no drag operation), or, if the user
      ended the drag-and-drop operation by canceling it (e.g., by hitting the <kbd>Escape</kbd> key),
      or if the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-26">current target element</a> is null, then the drag operation failed. Run
      these substeps:</p>
         <ol>
          <li>Let <var>dropped</var> be false.
          </li><li>If the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-27">current target element</a> is a DOM element, <a data-link-type="dfn" href="editing.html#fire-a-dnd-event" id="ref-for-fire-a-dnd-event-9">fire a DND
        event</a> named <code>dragleave</code> at it; otherwise, if
        it is not null, use platform-specific conventions for drag cancelation.
          </li><li>Set the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-11">current drag operation</a> to "<code>none</code>".
         </li></ol>
         <p>Otherwise, the drag operation might be a success; run these substeps:</p>
         <ol>
          <li>Let <var>dropped</var> be true.
          </li><li>If the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-28">current target element</a> is a DOM element, <a data-link-type="dfn" href="editing.html#fire-a-dnd-event" id="ref-for-fire-a-dnd-event-10">fire a DND
        event</a> named <code>drop</code> at it; otherwise, use
        platform-specific conventions for indicating a drop.
          </li><li>
           <p>If the event is canceled, set the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-12">current drag operation</a> to the value of the <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-dropeffect" id="ref-for-dom-datatransfer-dropeffect-10">dropEffect</a></code> attribute of the <code class="idl"><a data-link-type="idl" href="editing.html#dragevent-dragevent" id="ref-for-dragevent-dragevent-7">DragEvent</a></code> object’s <code class="idl"><a data-link-type="idl" href="editing.html#dom-dragevent-datatransfer" id="ref-for-dom-dragevent-datatransfer-5">dataTransfer</a></code> object as it stood after the event <a data-link-type="dfn" href="infrastructure.html#dispatch" id="ref-for-dispatch-6">dispatch</a> finished.</p>
           <p>Otherwise, the event is not canceled; perform the event’s default action, which depends
        on the exact target as follows:</p>
           <dl class="switch">
            <dt>If the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-29">current target element</a> is a text field (e.g., <code><a data-link-type="element" href="sec-forms.html#elementdef-textarea" id="ref-for-elementdef-textarea-82">textarea</a></code>,
          or an <code><a data-link-type="element" href="sec-forms.html#elementdef-input" id="ref-for-elementdef-input-290">input</a></code> element whose <code><a data-link-type="element-sub" href="sec-forms.html#element-attrdef-input-type" id="ref-for-element-attrdef-input-type-143">type</a></code> attribute
          is in the <a data-link-type="dfn" href="dom.html#text" id="ref-for-text-18">Text</a> state) or an <a data-link-type="dfn" href="editing.html#editing-host" id="ref-for-editing-host-10">editing
          host</a> or <a data-link-type="dfn" href="editing.html#editable" id="ref-for-editable-8">editable</a> element, and the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-26">drag data store item
          list</a> has an item with <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-20">the drag data item type string</a> "<code>text/plain</code>" and <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-14">the drag data item kind</a> <i>Plain Unicode
          string</i>
            </dt><dd>Insert the actual data of the first item in the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-27">drag data store item
          list</a> to have <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-21">a drag data item type
          string</a> of "<code>text/plain</code>" and <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-15">a drag
          data item kind</a> that is <i>Plain Unicode string</i> into the text field or <a data-link-type="dfn" href="editing.html#editing-host" id="ref-for-editing-host-11">editing host</a> or <a data-link-type="dfn" href="editing.html#editable" id="ref-for-editable-9">editable</a> element in a manner consistent with
          platform-specific conventions (e.g., inserting it at the current mouse cursor position, or
          inserting it at the end of the field).
            </dd><dt>Otherwise
            </dt><dd>Reset the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-13">current drag operation</a> to "<code>none</code>".
           </dd></dl>
         </li></ol>
        </li><li>
         <p><a data-link-type="dfn" href="editing.html#fire-a-dnd-event" id="ref-for-fire-a-dnd-event-11">Fire a DND event</a> named <code>dragend</code> at the <a data-link-type="dfn" href="editing.html#source-node" id="ref-for-source-node-10">source node</a>.</p>
        </li><li>
         <p>Run the appropriate steps from the following list as the default action of the <code>dragend</code> event:</p>
         <dl class="switch">
          <dt>If <var>dropped</var> is true, the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-30">current target element</a> is a <i>text
        field</i> (see below), the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-14">current drag operation</a> is "<code>move</code>", and the source of the
        drag-and-drop operation is a selection in the DOM that is entirely contained within an <a data-link-type="dfn" href="editing.html#editing-host" id="ref-for-editing-host-12">editing host</a>
          </dt><dd><a data-link-type="dfn" href="editing.html#delete-the-selection" id="ref-for-delete-the-selection-1">Delete the selection</a>.
          </dd><dt>If <var>dropped</var> is true, the <a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-31">current target element</a> is a <i>text
        field</i> (see below), the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-15">current drag operation</a> is "<code>move</code>", and the source of the
        drag-and-drop operation is a selection in a text field
          </dt><dd>The user agent should delete the dragged selection from the relevant text
        field.
          </dd><dt>If <var>dropped</var> is false or if the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-16">current drag operation</a> is "<code>none</code>"
          </dt><dd>The drag was canceled. If the platform conventions dictate that this be represented to
        the user (e.g., by animating the dragged selection going back to the source of the
        drag-and-drop operation), then do so.
          </dd><dt>Otherwise
          </dt><dd>The event has no default action.
         </dd></dl>
         <p>For the purposes of this step, a <i>text field</i> is a <code><a data-link-type="element" href="sec-forms.html#elementdef-textarea" id="ref-for-elementdef-textarea-83">textarea</a></code> element or an <code><a data-link-type="element" href="sec-forms.html#elementdef-input" id="ref-for-elementdef-input-291">input</a></code> element whose <code><a data-link-type="element-sub" href="sec-forms.html#element-attrdef-input-type" id="ref-for-element-attrdef-input-type-144">type</a></code> attribute is in
      one of the <a data-link-type="element-state" href="sec-forms.html#element-statedef-input-text" id="ref-for-element-statedef-input-text-55">Text</a>, <a data-link-type="element-state" href="sec-forms.html#element-statedef-input-search" id="ref-for-element-statedef-input-search-18">Search</a>, <a data-link-type="element-state" href="sec-forms.html#element-statedef-input-telephone" id="ref-for-element-statedef-input-telephone-10">Telephone</a>, <a data-link-type="element-state" href="sec-forms.html#element-statedef-input-url" id="ref-for-element-statedef-input-url-13">URL</a>, <a data-link-type="element-state" href="sec-forms.html#element-statedef-input-e-mail" id="ref-for-element-statedef-input-e-mail-15">E-mail</a>, <a data-link-type="element-state" href="sec-forms.html#element-statedef-input-password" id="ref-for-element-statedef-input-password-10">Password</a>, or <a data-link-type="element-state" href="sec-forms.html#element-statedef-input-number" id="ref-for-element-statedef-input-number-14">Number</a> states.</p>
       </li></ol>
     </li></ol>
     <p class="note" role="note"> User agents are encouraged to consider how to react to drags near the edge of scrollable
      regions. For example, if a user drags a link to the bottom of the <a data-link-type="dfn" href="infrastructure.html#viewport" id="ref-for-viewport-37">viewport</a> on a long page, it
      might make sense to scroll the page so that the user can drop the link lower on the page. </p>
     <p class="note" role="note"> This model is independent of which <code>Document</code> object the nodes involved are from;
      the events are fired as described above and the rest of the processing model runs as described
      above, irrespective of how many documents are involved in the operation. </p>
    </div>
    <h4 class="heading settled" data-level="5.7.6" id="events-summary"><span class="secno">5.7.6. </span><span class="content"><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="drag-and-drop events" data-noexport="" id="drag-and-drop-events">Events summary</dfn></span><a class="self-link" href="editing.html#events-summary"></a></h4>
    <p><em>This section is non-normative.</em></p>
    <p>The following events are involved in the drag-and-drop model.</p>
    <table>
     <thead>
      <tr>
       <th>Event Name
       </th><th>Target
       </th><th>Cancelable?
       </th><th><a data-link-type="dfn" href="editing.html#drag-data-store-mode" id="ref-for-drag-data-store-mode-7">Drag data store mode</a>
       </th><th><code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-dropeffect" id="ref-for-dom-datatransfer-dropeffect-11">dropEffect</a></code>
       </th><th>Default Action
     </th></tr></thead><tbody>
      <tr>
       <td><dfn class="dfn-paneled idl-code" data-dfn-for="global" data-dfn-type="event" data-export="" id="eventdef-global-dragstart"><code>dragstart</code></dfn>
       </td><td><a data-link-type="dfn" href="editing.html#source-node" id="ref-for-source-node-11">Source node</a>
       </td><td>✓ Cancelable
       </td><td><a data-link-type="dfn" href="editing.html#read-write-mode" id="ref-for-read-write-mode-6">Read/write mode</a> 
       </td><td>"<code>none</code>"
       </td><td>Initiate the drag-and-drop operation
      </td></tr><tr>
       <td><dfn class="dfn-paneled idl-code" data-dfn-for="global" data-dfn-type="event" data-export="" id="eventdef-global-drag"><code>drag</code></dfn>
       </td><td><a data-link-type="dfn" href="editing.html#source-node" id="ref-for-source-node-12">Source node</a>
       </td><td>✓ Cancelable
       </td><td><a data-link-type="dfn" href="editing.html#protected-mode" id="ref-for-protected-mode-5">Protected mode</a> 
       </td><td>"<code>none</code>"
       </td><td>Continue the drag-and-drop operation
      </td></tr><tr>
       <td><dfn class="dfn-paneled idl-code" data-dfn-for="global" data-dfn-type="event" data-export="" id="eventdef-global-dragenter"><code>dragenter</code></dfn>
       </td><td><a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-19">Immediate user selection</a> or <a href="sections.html#the-body-element">the <code>body</code> element</a>
       </td><td>✓ Cancelable
       </td><td><a data-link-type="dfn" href="editing.html#protected-mode" id="ref-for-protected-mode-6">Protected mode</a> 
       </td><td>Based on <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-effectallowed" id="ref-for-dom-datatransfer-effectallowed-11">effectAllowed</a></code> value
       </td><td>Reject <a data-link-type="dfn" href="editing.html#immediate-user-selection" id="ref-for-immediate-user-selection-20">immediate user selection</a> as potential <a data-link-type="dfn" href="browsers.html#target-element" id="ref-for-target-element-1">target element</a>
      </td></tr><tr>
       <td><dfn class="dfn-paneled idl-code" data-dfn-for="global" data-dfn-type="event" data-export="" id="eventdef-global-dragexit"><code>dragexit</code></dfn>
       </td><td><a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-32">Previous target element</a>
       </td><td>—
       </td><td><a data-link-type="dfn" href="editing.html#protected-mode" id="ref-for-protected-mode-7">Protected mode</a> 
       </td><td>"<code>none</code>"
       </td><td>None
      </td></tr><tr>
       <td><dfn class="dfn-paneled idl-code" data-dfn-for="global" data-dfn-type="event" data-export="" id="eventdef-global-dragleave"><code>dragleave</code></dfn>
       </td><td><a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-33">Previous target element</a>
       </td><td>—
       </td><td><a data-link-type="dfn" href="editing.html#protected-mode" id="ref-for-protected-mode-8">Protected mode</a> 
       </td><td>"<code>none</code>"
       </td><td>None
      </td></tr><tr>
       <td><dfn class="dfn-paneled idl-code" data-dfn-for="global" data-dfn-type="event" data-export="" id="eventdef-global-dragover"><code>dragover</code></dfn>
       </td><td><a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-34">Current target element</a>
       </td><td>✓ Cancelable
       </td><td><a data-link-type="dfn" href="editing.html#protected-mode" id="ref-for-protected-mode-9">Protected mode</a> 
       </td><td>Based on <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-effectallowed" id="ref-for-dom-datatransfer-effectallowed-12">effectAllowed</a></code> value
       </td><td>Reset the <a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-17">current drag operation</a> to "none"
      </td></tr><tr>
       <td><dfn class="dfn-paneled idl-code" data-dfn-for="global" data-dfn-type="event" data-export="" id="eventdef-global-drop"><code>drop</code></dfn>
       </td><td><a data-link-type="dfn" href="editing.html#previous-target-element" id="ref-for-previous-target-element-35">Current target element</a>
       </td><td>✓ Cancelable
       </td><td><a data-link-type="dfn" href="editing.html#read-only-mode" id="ref-for-read-only-mode-2">Read-only mode</a> 
       </td><td><a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-18">Current drag operation</a>
       </td><td>Varies
      </td></tr><tr>
       <td><dfn class="dfn-paneled idl-code" data-dfn-for="global" data-dfn-type="event" data-export="" id="eventdef-global-dragend"><code>dragend</code></dfn>
       </td><td><a data-link-type="dfn" href="editing.html#source-node" id="ref-for-source-node-13">Source node</a>
       </td><td>—
       </td><td><a data-link-type="dfn" href="editing.html#protected-mode" id="ref-for-protected-mode-10">Protected mode</a> 
       </td><td><a data-link-type="dfn" href="editing.html#current-drag-operation" id="ref-for-current-drag-operation-19">Current drag operation</a>
       </td><td>Varies
    </td></tr></tbody></table>
    <p>Not shown in the above table: all these events bubble, and the <code class="idl"><a data-link-type="idl" href="editing.html#dom-datatransfer-effectallowed" id="ref-for-dom-datatransfer-effectallowed-13">effectAllowed</a></code> attribute always has the value it had after the <code>dragstart</code> event, defaulting to
  "<code>uninitialized</code>" in the <code>dragstart</code> event.</p>
    <h4 class="heading settled" data-level="5.7.7" id="the-draggable-attribute"><span class="secno">5.7.7. </span><span class="content">The <code>draggable</code> attribute</span><a class="self-link" href="editing.html#the-draggable-attribute"></a></h4>
    <p>All <a data-link-type="dfn" href="infrastructure.html#html-element" id="ref-for-html-element-57">html elements</a> may have the <dfn class="dfn-paneled" data-dfn-for="global" data-dfn-type="element-attr" data-export="" id="element-attrdef-global-draggable"><code>draggable</code></dfn> content attribute set. The <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-draggable" id="ref-for-element-attrdef-global-draggable-5">draggable</a></code> attribute is an <a data-link-type="dfn" href="infrastructure.html#enumerated-attributes" id="ref-for-enumerated-attributes-23">enumerated attribute</a>. It has three states. The first
  state is <i>true</i> and it has the keyword <code>true</code>. The second state is <i>false</i> and it has the keyword <code>false</code>. The third state is <i>auto</i>; it has no keywords but
  it is the <i>missing value default</i>.</p>
    <p>The <i>true</i> state means the element is draggable; the <i>false</i> state means that it is not.
  The <i>auto</i> state uses the default behavior of the user agent.</p>
    <p>An element with a <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-draggable" id="ref-for-element-attrdef-global-draggable-6">draggable</a></code> attribute should also have a <code>title</code> attribute
  that names the element for the purpose of non-visual interactions.</p>
    <dl class="domintro">
     <dt><var>element</var> . <code class="idl"><a data-link-type="idl" href="editing.html#dom-htmlelement-draggable" id="ref-for-dom-htmlelement-draggable-3">draggable</a></code> [ = <var>value</var> ]
     </dt><dd>
       Returns true if the element is draggable; otherwise, returns false. 
      <p>Can be set, to override the default and set the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-draggable" id="ref-for-element-attrdef-global-draggable-7">draggable</a></code> content attribute.</p>
    </dd></dl>
    <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="HTMLElement" data-dfn-type="attribute" data-export="" id="dom-htmlelement-draggable"><code>draggable</code></dfn> IDL attribute, whose value depends on the content
    attribute’s in the way described below, controls whether or not the element is draggable.
    Generally, only text selections are draggable, but elements whose <code class="idl"><a data-link-type="idl" href="editing.html#dom-htmlelement-draggable" id="ref-for-dom-htmlelement-draggable-4">draggable</a></code> IDL
    attribute is true become draggable as well.</p>
    <p>If an element’s <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-draggable" id="ref-for-element-attrdef-global-draggable-8">draggable</a></code> content attribute has the state <i>true</i>, the <code class="idl"><a data-link-type="idl" href="editing.html#dom-htmlelement-draggable" id="ref-for-dom-htmlelement-draggable-5">draggable</a></code> IDL attribute must return true.</p>
    <p>Otherwise, if the element’s <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-draggable" id="ref-for-element-attrdef-global-draggable-9">draggable</a></code> content attribute has the state <i>false</i>,
    the <code class="idl"><a data-link-type="idl" href="editing.html#dom-htmlelement-draggable" id="ref-for-dom-htmlelement-draggable-6">draggable</a></code> IDL attribute must return false.</p>
    <p>Otherwise, the element’s <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-draggable" id="ref-for-element-attrdef-global-draggable-10">draggable</a></code> content attribute has the state <i>auto</i>. If
    the element is an <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-img" id="ref-for-elementdef-img-150">img</a></code> element, an <code><a data-link-type="element" href="semantics-embedded-content.html#elementdef-object" id="ref-for-elementdef-object-75">object</a></code> element that <a data-link-type="dfn" href="dom.html#represent" id="ref-for-represent-181">represents</a> an image, or an <code><a data-link-type="element" href="textlevel-semantics.html#elementdef-a" id="ref-for-elementdef-a-93">a</a></code> element with an <code><a data-link-type="element-sub" href="links.html#element-attrdef-a-href" id="ref-for-element-attrdef-a-href-36">href</a></code> content
    attribute, the <code class="idl"><a data-link-type="idl" href="editing.html#dom-htmlelement-draggable" id="ref-for-dom-htmlelement-draggable-7">draggable</a></code> IDL attribute must return true; otherwise, the <code class="idl"><a data-link-type="idl" href="editing.html#dom-htmlelement-draggable" id="ref-for-dom-htmlelement-draggable-8">draggable</a></code> IDL attribute must return false.</p>
    <p>If the <code class="idl"><a data-link-type="idl" href="editing.html#dom-htmlelement-draggable" id="ref-for-dom-htmlelement-draggable-9">draggable</a></code> IDL attribute is set to the value false, the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-draggable" id="ref-for-element-attrdef-global-draggable-11">draggable</a></code> content attribute must be set to the literal value "<code>false</code>".
    If the <code class="idl"><a data-link-type="idl" href="editing.html#dom-htmlelement-draggable" id="ref-for-dom-htmlelement-draggable-10">draggable</a></code> IDL attribute is set to the value true, the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-draggable" id="ref-for-element-attrdef-global-draggable-12">draggable</a></code> content attribute must be set to the literal value "<code>true</code>".</p>
    <h4 class="heading settled" data-level="5.7.8" id="the-dropzone-attribute"><span class="secno">5.7.8. </span><span class="content">The <code>dropzone</code> attribute</span><a class="self-link" href="editing.html#the-dropzone-attribute"></a></h4>
    <p>All <a data-link-type="dfn" href="infrastructure.html#html-element" id="ref-for-html-element-58">html elements</a> may have the <dfn class="dfn-paneled" data-dfn-for="global" data-dfn-type="element-attr" data-export="" id="element-attrdef-global-dropzone"><code>dropzone</code></dfn> content attribute set. When specified,
  its value must be an <a data-link-type="dfn" href="infrastructure.html#unordered-set-of-unique-space-separated-tokens" id="ref-for-unordered-set-of-unique-space-separated-tokens-5">unordered set of unique space-separated tokens</a> that are <a data-link-type="dfn" href="infrastructure.html#ascii-case-insensitive" id="ref-for-ascii-case-insensitive-49">ASCII case-insensitive</a>. The allowed values are the following:</p>
    <dl>
     <dt data-md="">
      <p><dfn data-dfn-type="dfn" data-noexport="" id="copy"><code>copy</code><a class="self-link" href="editing.html#copy"></a></dfn></p>
     </dt><dd data-md="">
      <p>Indicates that dropping an accepted item on the element will result in a copy of the dragged
  data.</p>
     </dd><dt data-md="">
      <p><dfn data-dfn-type="dfn" data-noexport="" id="move"><code>move</code><a class="self-link" href="editing.html#move"></a></dfn></p>
     </dt><dd data-md="">
      <p>Indicates that dropping an accepted item on the element will result in the dragged data being
  moved to the new location.</p>
     </dd><dt data-md="">
      <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="link"><code>link</code></dfn></p>
     </dt><dd data-md="">
      <p>Indicates that dropping an accepted item on the element will result in a link to the original
  data.</p>
     </dd><dt data-md="">
      <p>Any keyword with eight characters or more, beginning with an <a data-link-type="dfn" href="infrastructure.html#ascii-case-insensitive" id="ref-for-ascii-case-insensitive-50">ASCII case-insensitive</a> match for the string "<code>string:</code>"</p>
     </dt><dd data-md="">
      <p>Indicates that items with <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-16">the drag data item kind</a> <i>Plain Unicode string</i> and <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-22">the drag data item type string</a> set to a value that matches the remainder of the keyword
  are accepted.</p>
     </dd><dt data-md="">
      <p>Any keyword with six characters or more, beginning with an <a data-link-type="dfn" href="infrastructure.html#ascii-case-insensitive" id="ref-for-ascii-case-insensitive-51">ASCII case-insensitive</a> match
  for the string "<code>file:</code>"</p>
     </dt><dd data-md="">
      <p>Indicates that items with <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-17">the drag data item kind</a> <i>File</i> and <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-23">the drag data item
  type string</a> set to a value that matches the remainder of the keyword are accepted.</p>
    </dd></dl>
    <p>The <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-11">dropzone</a></code> content attribute’s values must not have more than one of the three
  feedback values (<code>copy</code>, <code>move</code>, and <code>link</code>) specified. If none
  are specified, the <code>copy</code> value is implied.</p>
    <p>An element with a <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-12">dropzone</a></code> attribute should also have a <code>title</code> attribute
  that names the element for the purpose of non-visual interactions.</p>
    <div class="impl">
      A <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-13">dropzone</a></code> attribute <dfn data-dfn-type="dfn" data-noexport="" id="matches-a-drag-data-store">matches a drag data store<a class="self-link" href="editing.html#matches-a-drag-data-store"></a></dfn> if the <a data-link-type="dfn" href="editing.html#dropzone-processing-steps" id="ref-for-dropzone-processing-steps-1"><code>dropzone</code> processing steps</a> result in a match. 
     <p>A <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-14">dropzone</a></code> attribute <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="specified|specifies an operation|specify an operation" data-noexport="" id="specified">specifies an operation</dfn> if the <a data-link-type="dfn" href="editing.html#dropzone-processing-steps" id="ref-for-dropzone-processing-steps-2"><code>dropzone</code> processing steps</a> result in a specified operation. The specified
    operation is as given by those steps.</p>
     <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="dropzone-processing-steps"><code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-15">dropzone</a></code> processing steps</dfn> are as follows. They either result in a
    match or not, and separate from this result either in a specified operation or not, as defined
    below.</p>
     <ol>
      <li data-md="">
       <p>Let <var>value</var> be the value of the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-16">dropzone</a></code> attribute.</p>
      </li><li data-md="">
       <p>Let <var>keywords</var> be the result of <a data-link-type="dfn" href="infrastructure.html#split-a-string-on-spaces" id="ref-for-split-a-string-on-spaces-9">splitting <var>value</var> on spaces</a>.</p>
      </li><li data-md="">
       <p>Let <var>matched</var> be false.</p>
      </li><li data-md="">
       <p>Let <var>operation</var> be unspecified.</p>
      </li><li data-md="">
       <p>For each value in <var>keywords</var>, if any, in the order that they were found in <var>value</var>, run the following steps.</p>
       <ol>
        <li data-md="">
         <p>Let <var>keyword</var> be the keyword.</p>
        </li><li data-md="">
         <p>If <var>keyword</var> is one of "<code>copy</code>", "<code>move</code>", or
"<code>link</code>", then: run the following substeps:</p>
         <ol>
          <li data-md="">
           <p>If <var>operation</var> is still unspecified, then let <var>operation</var> be the
string given by <var>keyword</var>.</p>
          </li><li data-md="">
           <p>Skip to the step labeled <i>end of keyword</i> below.</p>
         </li></ol>
        </li><li data-md="">
         <p>If <var>keyword</var> does not contain a U+003A COLON character (:), or if the first such
character in <var>keyword</var> is either the first character or the last character in
the string, then skip to the step labeled <i>end of keyword</i> below.</p>
        </li><li data-md="">
         <p>Let <var>kind code</var> be the substring of <var>keyword</var> from the first character
in the string to the last character in the string that is before the first U+003A COLON
character (:) in the string, <a data-link-type="dfn" href="https://www.w3.org/TR/dom/#converted-to-ascii-lowercase">converted to ASCII lowercase</a>.</p>
        </li><li data-md="">
         <p>Jump to the appropriate step from the list below, based on the value of <var>kind code</var>:</p>
         <dl class="switch">
          <dt>If <var>kind code</var> is the string "<code>string</code>"
          </dt><dd>Let <var>kind</var> be <i>Plain Unicode string</i>.
          </dd><dt>If <var>kind code</var> is the string "<code>file</code>"
          </dt><dd>Let <var>kind</var> be <i>File</i>.
          </dd><dt>Otherwise
          </dt><dd>Skip to the step labeled <i>end of keyword</i> below.
         </dd></dl>
        </li><li data-md="">
         <p>Let <var>type</var> be the substring of <var>keyword</var> from the first character after
the first U+003A COLON character (:) in the string, to the last character in the string, <a data-link-type="dfn" href="https://www.w3.org/TR/dom/#converted-to-ascii-lowercase">converted to ASCII lowercase</a>.</p>
        </li><li data-md="">
         <p>If there exist any items in the <a data-link-type="dfn" href="editing.html#drag-data-store-item-list" id="ref-for-drag-data-store-item-list-28">drag data store item list</a> whose <a data-link-type="dfn" href="editing.html#a-drag-data-item-kind" id="ref-for-a-drag-data-item-kind-18">drag data item kind</a> is  the kind given in <var>kind</var> and whose <a data-link-type="dfn" href="editing.html#item-type-string" id="ref-for-item-type-string-24">drag data item type string</a> is <var>type</var>, then let <var>matched</var> be
true.</p>
        </li><li data-md="">
         <p><i>End of keyword</i>: Go on to the next keyword, if any, or the next step in the overall
algorithm, if there are no more.</p>
       </li></ol>
      </li><li data-md="">
       <p>The algorithm results in a match if <var>matched</var> is true, and does not otherwise.</p>
       <p>The algorithm results in a specified operation if <var>operation</var> is not unspecified.
The specified operation, if one is specified, is the one given by <var>operation</var>.</p>
     </li></ol>
     <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="HTMLElement" data-dfn-type="attribute" data-export="" id="dom-htmlelement-dropzone"><code>dropzone</code></dfn> IDL attribute must <a data-link-type="dfn" href="infrastructure.html#reflection" id="ref-for-reflection-119">reflect</a> the content attribute of
    the same name.</p>
     <p>The <a data-link-type="dfn" href="infrastructure.html#supported-tokens" id="ref-for-supported-tokens-7">supported tokens</a> for <code class="idl"><a data-link-type="idl" href="editing.html#dom-htmlelement-dropzone" id="ref-for-dom-htmlelement-dropzone-2">dropzone</a></code> are the allowed values defined for the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-17">dropzone</a></code> attribute that are supported by the user agent.</p>
    </div>
    <div class="example" id="example-f22e4e7b">
     <a class="self-link" href="editing.html#example-f22e4e7b"></a> In this example, a <code><a data-link-type="element" href="grouping-content.html#elementdef-div" id="ref-for-elementdef-div-20">div</a></code> element is made into a drop target for image files using the <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-dropzone" id="ref-for-element-attrdef-global-dropzone-18">dropzone</a></code> attribute. Images dropped into the target are then displayed. 
<pre class="highlight"><span class="nt">&lt;div</span> <span class="na">dropzone=</span><span class="s">"copy file:image/png file:image/gif file:image/jpeg"</span> <span class="na">ondrop=</span><span class="s">"receive(event, this)"</span><span class="nt">&gt;</span>
<span class="nt">&lt;p&gt;</span>Drop an image here to have it displayed.<span class="nt">&lt;/p&gt;</span>
<span class="nt">&lt;/div&gt;</span>
<span class="nt">&lt;script&gt;</span>
<span class="kd">function</span> <span class="nx">receive</span><span class="p">(</span><span class="nx">event</span><span class="p">,</span> <span class="nx">element</span><span class="p">)</span> <span class="p">{</span>
  <span class="kd">var</span> <span class="nx">data</span> <span class="o">=</span> <span class="nx">event</span><span class="p">.</span><span class="nx">dataTransfer</span><span class="p">.</span><span class="nx">items</span><span class="p">;</span>
  <span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">data</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span> <span class="o">+=</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">((</span><span class="nx">data</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">kind</span> <span class="o">==</span> <span class="s1">'file'</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">data</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">type</span><span class="p">.</span><span class="nx">match</span><span class="p">(</span><span class="s1">'^image/'</span><span class="p">)))</span> <span class="p">{</span>
      <span class="kd">var</span> <span class="nx">img</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Image</span><span class="p">();</span>
      <span class="nx">img</span><span class="p">.</span><span class="nx">src</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">createObjectURL</span><span class="p">(</span><span class="nx">data</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">getAsFile</span><span class="p">());</span>
      <span class="nx">element</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">img</span><span class="p">);</span>
    <span class="p">}</span>
  <span class="p">}</span>
<span class="p">}</span>
<span class="nt">&lt;/script&gt;</span>
</pre>
    </div>
    <div class="impl">
     <h4 class="heading settled" data-level="5.7.9" id="security-risks-in-the-drag-and-drop-model"><span class="secno">5.7.9. </span><span class="content">Security risks in the drag-and-drop model</span><a class="self-link" href="editing.html#security-risks-in-the-drag-and-drop-model"></a></h4>
     <p>User agents must not make the data added to the <code class="idl"><a data-link-type="idl" href="editing.html#datatransfer-datatransfer" id="ref-for-datatransfer-datatransfer-30">DataTransfer</a></code> object during the <code>dragstart</code> event available to scripts until the <code>drop</code> event, because
    otherwise, if a user were to drag sensitive information from one document to a second document,
    crossing a hostile third document in the process, the hostile document could intercept the data.</p>
     <p>For the same reason, user agents must consider a drop to be successful only if the user
    specifically ended the drag operation — if any scripts end the drag operation, it must be
    considered unsuccessful (canceled) and the <code>drop</code> event must not be fired.</p>
     <p>User agents should take care to not start drag-and-drop operations in response to script
    actions. For example, in a mouse-and-window environment, if a script moves a window while the
    user has his mouse button depressed, the user agent would not consider that to start a drag. This is
    important because otherwise user agents could cause data to be dragged from sensitive sources and
    dropped into hostile documents without the user’s consent.</p>
     <p>User agents should filter potentially active (scripted) content (e.g., HTML) when it is dragged
    and when it is dropped, using a safelist of known-safe features. Similarly, <a data-link-type="dfn" href="https://url.spec.whatwg.org/#syntax-url-relative">relative URLs</a> should be turned into absolute URLs to avoid references changing in unexpected ways. This
    specification does not specify how this is performed.</p>
     <div class="example" id="example-5c09ff14"><a class="self-link" href="editing.html#example-5c09ff14"></a> Consider a hostile page providing some content and getting the user to select and drag and
      drop (or indeed, copy and paste) that content to a victim page’s <code><a data-link-type="element-sub" href="editing.html#element-attrdef-global-contenteditable" id="ref-for-element-attrdef-global-contenteditable-4">contenteditable</a></code> region. If the browser does not ensure that only safe content is dragged, potentially unsafe
      content such as scripts and event handlers in the selection, once dropped (or pasted) into the
      victim site, get the privileges of the victim site. This would thus enable a cross-site
      scripting attack. </div>
    </div>
   </section></main>
  
<script src="js/fixup.js"></script>
  

<p class="prev_next">← <a href="matching-html-elements-using-selectors.html#matching-html-elements-using-selectors"><span class="secno">4.15</span> <span class="content">Matching HTML elements using selectors</span></a> — <a href="index.html#contents">Table of contents</a> — <a href="browsers.html#browsers"><span class="secno">6</span> <span class="content">Loading Web pages</span></a> →</p></body></html>
